#!/bin/sh
check() {
if [ ! -d ${1} ]; then
echo "${1} is not a dir"; exit 1
fi
echo "{$1} is a directory"
}
# HOME is normally always defined for a process
check $HOME
What are you trying to do? Determine if the HOME variable is set correctly?
Hi,
I would like to write a function which takes one integer argument and adds 10 to it. But, I'd like to return the result in the data that was passed in. Is this possible?
function1()
{
1=$(($1+10))
}
my_number=1
function "$my_number"
echo $my_number
I'd like the echo... (1 Reply)
Simple shell script :
date
test_fn()
{
echo "function within test shell script "
}
on the shell prompt I run
> . test
Then I invoke the function on the command line as below :
test_fn()
It echos the line
function within test shell script
and works as expected.
... (5 Replies)
i've been told that c shell does not support functions/subroutines is that true?
if not can somebody give me the basic syntax for creating a function. it would very much appreciated!
thanks in advance (1 Reply)
Hi All,
I have a very long code called myfunction -> "if ..... else if .... else if ..end if "
And i have several other codes which need to call the "myfunction" code.
How can C-shell call a function "B]myfunction" ? Can any body give me an example ?? (1 Reply)
Hi,
I have a query ..
i have 2 scripts say 1.sh and 2.sh
1.sh contains many functions written using shell scripts.
2.sh is a script which needs to call the functions definded in 1.sh
function calls are with arguments.
Can some one tell me how to call the functions from 2.sh?
Thanks in... (6 Replies)
Please excuse my ineptitude for a bit as I've been spoiled for the past few months with only writing perl code instead of C.
So ok, I've been thinking about some code to change the crc32 values that are held within central directory headers of zip files.
Because I'm lazy I decided to just... (3 Replies)
Guys,
May i know how can we de reference the code reference variable.?
my $a = sub{$a=shift;$b=shift;print "SUM:",($a+$b),"\n";};
print $a->(4,5);
How can we print the whole function ?
Please suggest me regarding this.
Thanks for your time :)
Cheers,
Ranga :) (0 Replies)
Hi ,
I have a script which is using a text file as I/P.
I want a code where it reads n lines from this file and pass the parameters to a function and now this script should run in such a way where a function can be called in parallel with different parameters. Please find below my script, it... (1 Reply)
so i noticed that when a shell script has a function defined in it, running "sh -x" on that shell script from the command line doesnt show what the function is doing. i like this.
is there anyway for anyone to get around that? to be able to see exactly what a function or functions are doing? (4 Replies)
Dear Friends,
Please help me on this
my script name is send.csh
In this i have written the statement like this
set args = ( city state country price )
I want to pass this array to another c shell called receiver.csh. and i want to use it in this c shell
or
how to pass to... (2 Replies)
Discussion started by: SA_Palani
2 Replies
LEARN ABOUT SUNOS
wnoutrefresh
doupdate(3XCURSES) X/Open Curses Library Functions doupdate(3XCURSES)NAME
doupdate, refresh, wnoutrefresh, wrefresh - refresh windows and lines
SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib
-R /usr/xpg4/lib -lcurses [ library... ]
c89 [ flag... ] file... -lcurses [ library... ]
#include <curses.h>
int doupdate(void);
int refresh(void);
int wnoutrefresh(WINDOW *win);
int wrefresh(WINDOW *win);
DESCRIPTION
The refresh() and wrefresh() functions copy stdscr and win, respectively, to the terminal screen. These functions call the wnoutrefresh()
function to copy the specified window to curscr and the doupdate() function to do the actual update. The physical cursor is mapped to
the same position as the logical cursor of the last window to update curscr unless leaveok(3XCURSES) is enabled (in which case, the cur-
sor is placed in a position that X/Open Curses finds convenient).
When outputting several windows at once, it is often more efficient to call the wnoutrefresh() and doupdate() functions directly. A call
to wnoutrefresh() for each window, followed by only one call to doupdate() to update the screen, results in one burst of output, fewer
characters sent, and less CPU time used.
If the win parameter to wrefresh() is the global variable curscr, the screen is immediately cleared and repainted from scratch.
For details on how the wnoutrefresh() function handles overlapping windows with broad glyphs, see the Overlapping Windows section of the
curses(3XCURSES) reference manual page.
PARAMETERS
win Is a pointer to the window in which to refresh.
RETURN VALUES
On success, these functions return OK. Otherwise, they return ERR.
ERRORS
None.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO clearok(3XCURSES), curses(3XCURSES), libcurses(3XCURSES), prefresh(3XCURSES), redrawwin(3XCURSES), attributes(5), standards(5)SunOS 5.10 5 Jun 2002 doupdate(3XCURSES)