12-10-2007
code snippet
Quote:
Originally Posted by
porter
It would help if you explained how you were using the script and it's functions.
Hi
function imple()
{
if [ ! -d $sourcedir ] ; then
echo " $sourcedir is not found from the release directory $RELPATH " | tee -a $REPLIMPLOG
exit // This exit is throwing me out of the session
elif [ ! -d $destdir ] ; then
echo " $destdir is not available in the production environment. " | tee -a $REPLIMPLOG
exit // This exit is throwing me out of the session
elif [ ! -d $destbak ] ; then
echo " $destbak is not available in the production environment. " | tee -a $RELIMPLOG
exit // This exit is throwing me out of the session
else
valid_flag=0
fi
}
I hope this is enough for u.
10 More Discussions You Might Find Interesting
1. Programming
In one of my programs another process is called using the system command e.g.
lv_error = system("myproc");
where lv_error is declared as an int.
myproc would be returning 0 for success and 1 for failure. e.g.
if (success)
{
return(0);
}else{
return(1);
}
When the return code... (3 Replies)
Discussion started by: mbb
3 Replies
2. Shell Programming and Scripting
Hi All,
just wanted to ask if functions created in a Korn shell script can be passed parameters and if so what is the syntax for creating a function with parameters?
thanks
Mani (3 Replies)
Discussion started by: scriptingmani
3 Replies
3. Shell Programming and Scripting
Hy everybody
I'm trying to write a function like
function(){
final=$1
return $final
}
but I get following error:
"return: bad non-numeric arg ''"
what shall I do? Isn't it possible to return strings?:confused:
thanks
lucae (2 Replies)
Discussion started by: lucae
2 Replies
4. Shell Programming and Scripting
Hi,
I need to do a test Telnet in KSH and if the connection is good then disconnect the telnet session with out logging in and without exiting the shell script.
Example output of a good connection:
$telnet xxx.xx.xx.xxx xxxx
Trying xxx.xx.xx.xxx...
Connected to xxx.xx.xx.xxx.
Escape... (1 Reply)
Discussion started by: calex
1 Replies
5. Shell Programming and Scripting
Let me know if there is a way to pass array to a funtion in ksh script.
function isPresent
{
typeset member
member=$1
dbList=$2
echo '$1:' $1
echo '$2' $dbList
The array will be at the second position....something like this
isPresent 12 <array>
if
then
echo... (3 Replies)
Discussion started by: prasperl
3 Replies
6. Shell Programming and Scripting
hi
while executing the following script, my terminal window is getting closed if I enter a invalid option. I want the script should go back the the command prompt. how to do achive it. i execute the script as . ./test
#! /usr/bin/ksh
Printf " Type of Installer : \n\t\t 1. Whole Build... (3 Replies)
Discussion started by: vij_krr
3 Replies
7. Shell Programming and Scripting
Hello
Okay, for reasons related to sourcing a script from another script, I've had to put my main loop into a function, and from there I call other functions. My problem then is exiting from deep within the function call stack.
I used to simply call exit, and that would accomplish what I... (1 Reply)
Discussion started by: brsett
1 Replies
8. Shell Programming and Scripting
Hi Everyone,
I am confused on why the below snippet of code is not working as I intend it to do. I have googled and confirmed that "exit" is supposed to abort the execution of the script regardless if the exit was called from inside a function, or the main body of the script.
log_and_die() {
... (3 Replies)
Discussion started by: maddmaster
3 Replies
9. Shell Programming and Scripting
Hi
Im trying to write a script that will archive some file using java program.Below is the part of the script that I use and my problem is that the script always return with status 0.Below is part of my script(end part)
purge.ksh
echo "No of files before tar :... (4 Replies)
Discussion started by: saachinsiva
4 Replies
10. Shell Programming and Scripting
I'm reading a text file using a while loop but when I call a function from within this loop it exits that same iteration … even though there are many more lines in the file to be read.
I thought it was something to do with the IFS setting but it appears that a function call (when run... (3 Replies)
Discussion started by: user052009
3 Replies
tee(1) General Commands Manual tee(1)
NAME
tee - Displays the output of a program and copies it into a file
SYNOPSIS
tee [-ai] file...
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
tee: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
Adds the output to the end of file instead of writing over it. Ignores the SIGINT signal.
OPERANDS
Standard input is stored into, or appended to, the file specified.
[Tru64 UNIX] The tee command can accept up to 20 file arguments.
DESCRIPTION
The tee command reads standard input and writes to both standard output, and each specified file.
The tee command is useful when you wish to view program output as it is displayed, and also want to save it in a file. The tee command does
not buffer output, so you may wish to pipe the output of tee to more if more than one full screen of data is anticipated.
NOTES
If a write to any file fails, the exit status of tee will be non-zero. Writes to all other specified files may be successful, and opera-
tion will continue until standard input is exhausted.
EXIT STATUS
The following exit values are returned: Successful completion. An error occurred.
EXAMPLES
To view and save the output from a command at the same time, enter: lint program.c | tee program.lint
This displays the standard output of the command lint program.c at the terminal, and at the same time saves a copy of it in the file
program.lint. If program.lint already exists, it is deleted and replaced. To display and append to a file, enter: lint program.c |
tee -a program.lint
This displays the standard output of lint program.c at the terminal and at the same time appends a copy of it to the end of pro-
gram.lint. If the file program.lint does not exist, it is created.
ENVIRONMENT VARIABLES
The following environment variables affect the execution of tee: Provides a default value for the internationalization variables that are
unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari-
ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value,
overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes
of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for-
mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of
LC_MESSAGES.
SEE ALSO
Commands: cat(1), echo(1), script(1)
Standards: standards(5)
tee(1)