Results 1 to 2 of 2
Hi friends
(i) i have written a function say func() and i have a if codition in it, now if that if condition satisfies than it need to skip the ...
- 07-13-2010 #1Just Joined!
- Join Date
- Apr 2010
- Posts
- 12
Return statement in shell script and execute function from prompt
Hi friends
(i) i have written a function say func() and i have a if codition in it, now if that if condition satisfies than it need to skip the remaining statements after that if condition in the func() function. for this criteria we have return statement in C language how can i acheive the same in shell scripting ?
(ii) I have written some functions in a file say myprofile.sh and say one of the function name is doc(). Now my requirement is that when i execute the file myrofile.sh
$sh myprofile.sh after executing it now wheni am executing doc() from the command prompt i am getting an error as
devlinux11(lrathod): doc
bash: doc: command not found
how can i acheive this ?
- 07-13-2010 #2Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
1. Use the return statement likewise
2. Source your script with the . (dot) or source command0 + 1 = 1 != 2 <> 3 != 4 ...
Until the camel can pass though the eye of the needle.


Reply With Quote