![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's | manas6 | UNIX for Dummies Questions & Answers | 0 | 06-05-2008 03:44 AM |
| return code from script | mpang_ | Shell Programming and Scripting | 2 | 10-23-2007 02:50 PM |
| asking about return code | naamas03 | Shell Programming and Scripting | 3 | 08-28-2007 01:53 AM |
| Return Code of tar in AIX | dupeng | AIX | 3 | 02-22-2004 08:05 PM |
| return code from oracle | lesstjm | Shell Programming and Scripting | 3 | 01-29-2002 11:50 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
how to get return code in one line
I know how to get the returning code of a function but wonder if I can combine the follwoing two lines into one:
e.g.: #!/bin/shell ... #line 1 MyFunction arg1 arg 2 #line 2 rec=$? #this will be evaluated later .... like in c/c++, we'd write one line: rec=MyFunction(arg1, arg 2) Because I have many of those funciton calls in one script where all return codes need to be collected & evaluated later. It'd look nicer with one less line here. Thanks in advance. Last edited by bluemoon1; 09-13-2007 at 02:45 PM. |
| Forum Sponsor | ||
|
|
|
|||
|
very neat! I tested it & looks the if statement evaluates if the returning code is 0 or not, isn't it??
However, I failed to make it to check if it is non-zero- tried a few syntax with no luck... such as: if [ ! domything ], if [ domything -ne 0 ].... can you make it?;-) |
|
|||
|
Quote:
There is a program called "true" and one called "false", there should be one called "not".... Code:
#!/bin/sh
if $@
then
exit 1
fi
exit 0
Code:
if not myprogram then ..... |
|
|||
|
wow... thank you "Porter"- or whoever you really are;-)
I've been doing a program with this new language in last couple of weeks. Now I'm really interested in learning more! I want to be as good as you one day... oh well, just wishful thinking;-) |
|||
| Google UNIX.COM |