12-10-2007
Quote:
Originally Posted by
sharif
Hi I am having the script which contains more functions. I want to exit the function if any failure. I tried with exit - the session itself is getting logged out. How can i fix this issue?
It may depend on how you invoke the script.
If you invoke the script as . ./yourscript.sh, then it would exit from the session as well.
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
LEARN ABOUT SUSE
ivman-launch
IVMAN-LAUNCH(8) System Manager's Manual IVMAN-LAUNCH(8)
NAME
ivman-launch - launch script for Ivman
SYNOPSIS
ivman-launch [ --exit-with-session <cmd> ] [ OPTIONS ] [ COMMAND [ ARGS... ]]
DESCRIPTION
ivman-launch is a simple script used to launch Ivman. Its sole purpose is to ensure Ivman is closed at the end of a user's login session.
You can use it if your session manager does not properly close Ivman when you log out.
ivman-launch supports the same command-line options as Ivman, and one additional option: --exit-with-session. Thus, there is no point
using ivman-launch if you do not need to use this option.
If you supply a COMMAND (with optional ARGS), the the specified command will be run after ivman is started, and ivman will be killed after
that command exits.
OPTIONS
--exit-with-session <cmd>
ivman-launch will block until the command 'cmd' terminates, at which point it will kill Ivman and exit itself. If the command 'cmd'
is not running when ivman-launch is started, Ivman will exit immediately. Note that this option implies Ivman will be called with
the '--nofork' option. option.
--debug --nofork --system
These flags be passed to the launched ivman command.
EXAMPLES
ivman-launch --exit-with-session xinit &
The ivman process will be started, then the xinit process is watched. When the xinit process exits, ivman is killed. Placing this
command in an ~/.xinitrc file would cause Ivman to launch in the background when your session begins, and exit when your session
ends:
ivman-launch /usr/bin/x-window-manager
The ivman process is launched, then /usr/bin/x-window-manager is run, when x-window-manager exits, ivman is killed. This is an
example of how ivman might be launched from Xsession in order to chain several programs together in one session.
SEE ALSO
ivman(8) Xsession(5)
CREDITS
This script was written by Daniele Favara.
10 February 2006 IVMAN-LAUNCH(8)