![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to get the exit status | yhacks | Shell Programming and Scripting | 1 | 05-19-2008 09:06 AM |
| Capturing last command execution status in a script. | videsh77 | Shell Programming and Scripting | 2 | 04-12-2007 02:19 PM |
| exit status | moxxx68 | Shell Programming and Scripting | 1 | 12-04-2004 07:27 PM |
| tar exit status | thorndike | UNIX for Dummies Questions & Answers | 3 | 01-22-2002 04:39 PM |
| ftp exit status. | oracle8 | UNIX for Advanced & Expert Users | 1 | 10-22-2001 12:34 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
capturing exit status ($?) in subshell ??
I am trying to capture the exit status of a parent shell
in a subshell. I am using the trap .. Exit command in the subshell I cant use the export command in the parent shell to to export a variable with the exit status to the subshell. I would have tooooo many parent shells to change. Parent Shell . /subshell #Include sub shell Code code .... exit 1 End of Parent Shell subshell 'trap echo $? ' EXIT #End subshell My problem is the echo command displays 0. Any ideas would be greatllllly appreciated ![]() |
|
|||||
|
What you are calling a subshell isn't one and you seem to have parent and child mixed up.
If you write a command and call it "subshell". you can run it and get the exit code like this.. ./subshell exitcode=$? And it doesn't matter that "subshell" is command that is also a shell script. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|