![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How can I identify the last saved log? | gugs | Shell Programming and Scripting | 20 | 10-14-2008 06:55 PM |
| script in saved in compress format | naveeng.81 | Shell Programming and Scripting | 1 | 04-14-2008 09:31 AM |
| Sudo file not saved | Asteroid | UNIX for Advanced & Expert Users | 0 | 07-30-2007 08:18 AM |
| only root's crontab gets not saved | flok | UNIX for Advanced & Expert Users | 1 | 06-25-2007 11:50 AM |
| Where are the password saved in a UNIX server? | hast5 | UNIX for Dummies Questions & Answers | 12 | 10-19-2006 05:11 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Guys i'm trying to save STDERR to a variable for a portion of my ksh script on solaris.
I know i can create redirects to files as such: exec 4>/tmp/lava print "This will be saved to /tmp/lava and not screen"; >&4 print "This will be seen on screen" >&2 I want to save the STDOUT of a command to a variable and save STDERR to another without having to have files everywhere. e.g tapelist=$( command blah blah ) I then want to check if tapelist contains anything and run stuff otherwise dont i.e if [[ -n "{tapelist}" ]];then do stuff.... else do other stuff fi If the command fails it produces STDERR output i want to save so i can print it out later. So in my thoughts although i know this doesnt work :- savestderr=""; exec 3>${savestderr} tapelist=$(command blah blah 2>&3) Then can reference the error message as ${savestderr} Any ideas? Last edited by lavascript; 04-17-2009 at 08:38 AM.. Reason: whats wrong with the formatting? |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|