The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
exit a shell script!! sami98 Shell Programming and Scripting 4 03-27-2007 04:55 AM
Have a shell script call another shell script and exit heprox Shell Programming and Scripting 2 11-20-2006 08:17 AM
checking exit status of a shell script kdipankar Shell Programming and Scripting 2 05-09-2006 01:08 AM
exit shell script from function nvrh7 Shell Programming and Scripting 1 11-27-2005 11:28 AM
using exit command in a shell script jpprial UNIX for Dummies Questions & Answers 1 02-16-2001 12:45 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-29-2008
Sreejith_VK
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
unable to exit from a shell script

Hi All,

I am unable to exit from a shell script using the below code:
Code:

#!/bin/ksh
passchk()
(
if [ 0 = "$finalresult" ];then
    echo "Password validated"
else
    echo "Wrong password Quiting the application..."
    exit 0#not working
fi
)
passchk
(Note:"finalresult" passed to the passchk function)
How can I rectify this?
  #2 (permalink)  
Old 05-29-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Unless ksh has some unusual syntax I haven't seen before, the delimiters around the function body should be curly braces, not round ones. With round parentheses, you are running (and "successfully" exiting) a subshell, leaving the shell which runs the current script unaffected.
  #3 (permalink)  
Old 05-30-2008
Sreejith_VK
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Thanks era.
It worked.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0