- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- nohup - capturing the return value from the comman...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2002 04:34 AM
тАО05-15-2002 04:34 AM
nohup (command; echo $? >rv.out) &
but I receive a syntax error:
sh: Syntax error: '(' is not expected
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2002 04:43 AM
тАО05-15-2002 04:43 AM
Re: nohup - capturing the return value from the command
Try $? after the nohup command. This will return the exit code for the command run using nohup,
nohup command;echo $?
do a "man nohup" for more info.
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2002 04:45 AM
тАО05-15-2002 04:45 AM
Re: nohup - capturing the return value from the command
From man nohup
nohup executes command with hangups and quits ignored. If output is
not redirected by the user, both standard output and standard error
are sent to nohup.out. If nohup.out is not writable in the current
directory, output is redirected to $HOME/nohup.out; otherwise, nohup
fails. If a file is created, the file's permission bits will be set to
S_IRUSR | S_IWUSR.
If output from nohup is redirected to a terminal, or is not redirected
at all, the output is sent to nohup.out.
So:-
nohup {filename] >log.file &
HTH
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2002 04:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2002 04:47 AM
тАО05-15-2002 04:47 AM
Re: nohup - capturing the return value from the command
Some more information on what you are trying to achieve would be useful...
However, as per 'man nohup', nohup will not accept a list of commands. You have to write a shell script to run the commands and nohup the script.
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2002 05:11 AM
тАО05-15-2002 05:11 AM
Re: nohup - capturing the return value from the command
nohup command;echo $?
works for commands executed in the foreground, but I want to execute the command in the background.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2002 05:34 AM
тАО05-15-2002 05:34 AM
Re: nohup - capturing the return value from the command
nohup will not accept a list of commands. You have to write a shell script to run the commands and nohup the script.
It also states:
Be careful to place punctuation properly. For example, in the command form:
nohup command1; command2
nohup applies only to command1. To correct the problem, use the command form:
nohup (command1; command2)
***
I wish to capture the return value from the command that runs nohup in the background.