Problem with exit command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Problem with exit command
# 1  
Old 04-29-2009
Problem with exit command

Problem with exit command
-----------------------------------------------------------------------
Hi,
I am executing script written by other user.
I am executing script A.ksh, and A.ksh calls B.ksh.

But It is giving error:
/home/user/B.ksh[132]: exit: -1: unknown option

When I checked B.ksh
It has following lines of code


if [ $success = 0 ]
then
...
some action
...
else
...
some action
...
exit -1
fi



Can you please help me?
Thank you
# 2  
Old 04-29-2009
Quote:
Originally Posted by shreyas
Problem with exit command
-----------------------------------------------------------------------
Hi,
I am executing script written by other user.
I am executing script A.ksh, and A.ksh calls B.ksh.

But It is giving error:
/home/user/B.ksh[132]: exit: -1: unknown option

When I checked B.ksh
It has following lines of code


if [ $success = 0 ]
then
...
some action
...
else
...
some action
...
exit -1
fi



Can you please help me?
Thank you

Try
Code:
exit 1

cheers,
Devaraj Takhellambam
# 3  
Old 04-29-2009
Can't we use -1 ???
# 4  
Old 04-29-2009
Quote:
Originally Posted by shreyas
Can't we use -1 ???
usually a decimal number in the 0 - 255 range. Please see

Code:
man exit


cheers,
Devaraj Takhellambam
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

while loop stops after first iteration - remote ssh exit command problem?

I have written the following script to update some Debian boxes. #!/bin/bash mxg_hosts_file="/etc/mxg/ssh-hosts" while read line ; do mxg_host="$(echo ${line} | awk -F":" '{print $1}')" mxg_port="$(echo ${line} | awk -F":" '{print $2}')" echo "Connecting and Upgrading... (3 Replies)
Discussion started by: jelloir
3 Replies

2. UNIX for Advanced & Expert Users

Equivalents of tee command to find exit status of command

Hi, Want to log the output of command & check the exit status to find whether it succeeded or failed. > ls abc ls: abc: No such file or directory > echo $? 1 > ls abc 2>&1 | tee log ls: abc: No such file or directory > echo $? 0 Tee commands changes my exit status to be always... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies

3. Shell Programming and Scripting

Problem using exit(1)

Hi All, i have a script named as 1. scr_FTP.sh, it calls the script(2) 2. file_create.sh And in that 2nd script, i use the below function run_complete_workflow(). I introduced exit(1) to exit from the function: run_complete_workflow() and also from the 2nd script: file_create.sh and... (3 Replies)
Discussion started by: vsmeruga
3 Replies

4. Shell Programming and Scripting

problem in exit status of the command in a shell script-FTP

Hi All, I have developed below script for FTP a file from unix machine to another machine. ftpToABC () { USER='xyz' PASSWD='abc' echo "open xx.yy.zbx.aaa user $USER $PASSWD binary echo "put $1 abc.txt" >> /home/tmp/ftp.$$ echo "quit" >> /home/tmp/ftp.$$ ftp -ivn <... (3 Replies)
Discussion started by: RSC1985
3 Replies

5. Shell Programming and Scripting

SubMenu Exit problem!

I basically have a menu driven script in which one of the options from the main menu would open a sub menu, this works fine but i can't seem to be able to exit the sub menu back to the main menu....any ideas? (5 Replies)
Discussion started by: Alendrin
5 Replies

6. Shell Programming and Scripting

problem with exit while using nohup

Hi, I am kinda confused with this, am not sure what is happening i have a script say test.sh ---------- cat myfile | while read line do exit 2 done echo "out of loop" ----------- as it is evident, the exit should cause the script to terminate ,hence producing no output for the... (1 Reply)
Discussion started by: sumirmehta
1 Replies

7. Shell Programming and Scripting

Move Command and exit status problem

Hi All, I am using the following code to move files from one folder to another on the remote server: ssh username@server <<EOF cd source_dir find . -type f -name "*.txt" |xargs -n1000 -i{} mv {} dest_dir if then send mail indicating error otherwise echo "success" fi EOF ... (10 Replies)
Discussion started by: visingha
10 Replies

8. UNIX for Dummies Questions & Answers

Move Command and exit status problem

Hi All, I am using the following code to move files from one folder to another on the remote server: ssh username@server <<EOF cd source_dir find . -type f -name "*.txt" |xargs -n1000 -i{} mv {} dest_dir if then send mail indicating error otherwise echo "success" fi EOF ... (1 Reply)
Discussion started by: visingha
1 Replies

9. Shell Programming and Scripting

problem with exit code when piping

i am writing a script to perform some mysqldumps and gzip them. The problem I am running into is that if the user specifies a database that doesn't exist, the error the mysql engine produces is still piped into gzip, and the exit code returned is 0. If I don't pipe into gzip, an exit code... (4 Replies)
Discussion started by: bitoffish
4 Replies

10. Shell Programming and Scripting

Problem with exit status

Hi, Consider the output of the following commands: case1) ------- # ifconfig -a | grep "UP" | grep uplink0:1 # echo $? Output is: 0 case2 ------ # ifconfig -a | grep "UP" | grep uplink0:1; echo $? Output is: 1 In case2 we got the exit code as 1, which is the actual exit code.... (1 Reply)
Discussion started by: diganta
1 Replies
Login or Register to Ask a Question