LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-13-2010, 09:44 AM   #1
slinx
Member
 
Registered: Apr 2008
Location: Cleveland, Ohio
Distribution: SuSE, CentOS, Fedora, Ubuntu
Posts: 106

Rep: Reputation: 23
Unhappy how to get return value from command run within screen?


Hello,

I'm trying to get a return value from the command running within screen. I have tried

Code:
screen "some_command ; echo \$? > retval"
but this refuses to write "retval".

Is there any way to pass the return value of a command to the return value of screen, or some other way to get it?

Thanks!
 
Old 01-14-2010, 09:50 AM   #2
slinx
Member
 
Registered: Apr 2008
Location: Cleveland, Ohio
Distribution: SuSE, CentOS, Fedora, Ubuntu
Posts: 106

Original Poster
Rep: Reputation: 23
Figured this one out - the problem is that screen was requiring an absolute path. So if I create a wrapper script, such as "/usr/local/bin/command":

Code:
#!/bin/bash

<run my command>

echo $? > $0.retval
then, the screen command

Code:
screen /usr/local/bin/command
leaves the return value from <run my command> in /usr/local/bin/command.retval
 
  


Reply

Tags
screen



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
run smbpasswd return an error message jodie Linux - Newbie 1 10-02-2008 03:45 PM
how to return to default screen? karindiaconu Linux - Newbie 3 01-11-2008 01:14 PM
How to return the previous screen resolution salve0000 Linux - Newbie 4 06-15-2006 12:27 AM
How can I go to the windows screen from the command line on suse, on run level 3? abefroman SUSE / openSUSE 1 05-08-2005 07:00 PM
Error when trying to run ET:Return to Castel Wolfenstein lilrowdy18 Linux - Software 5 01-28-2005 02:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration