what does this command do? | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

what does this command do?

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 04-29-2008
wrapster wrapster is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 26 January 2011, 9:16 AM EST
Posts: 194
Thanks: 0
Thanked 0 Times in 0 Posts
what does this command do?

Hi all,

I would like to know how this command works

exec </dev/console >/dev/console 2>&1

Also please pay particular attention to the syntax and i would like to know if the syntax is correct (particularly the spacing!!)
Am trying to debug a script at boot time and am not getting any errors so thought i would use this to figure out what's going wrong?

Thanks
Sponsored Links
    #2  
Old 04-29-2008
Cameron's Avatar
Cameron Cameron is offline Forum Advisor  
Registered User
 
Join Date: Nov 2001
Last Activity: 23 October 2011, 10:07 PM EDT
Location: Brisbane, Australia
Posts: 509
Thanks: 7
Thanked 0 Times in 0 Posts
What type of script are you trying to debug ?
Anything in the rc.log ??
Sponsored Links
    #3  
Old 04-29-2008
wrapster wrapster is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 26 January 2011, 9:16 AM EST
Posts: 194
Thanks: 0
Thanked 0 Times in 0 Posts
well not an rc script in the technical sense, but its a boot up script that does all the loading of drivers and mounting FS from the cdrom to respective places....

Am actually working on a opensolaris distro.
And here the notion of rc scripts is obsolete ,its in the form of services and milestones!!!

could you shed some light on it now?
    #4  
Old 04-29-2008
Cameron's Avatar
Cameron Cameron is offline Forum Advisor  
Registered User
 
Join Date: Nov 2001
Last Activity: 23 October 2011, 10:07 PM EDT
Location: Brisbane, Australia
Posts: 509
Thanks: 7
Thanked 0 Times in 0 Posts
Sorry wrapster, never dealt with opensolaris.

Be patient, someone's bound to know and provide some light.
Sponsored Links
    #5  
Old 04-29-2008
wrapster wrapster is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 26 January 2011, 9:16 AM EST
Posts: 194
Thanks: 0
Thanked 0 Times in 0 Posts
ok ,
No problem,thanks for taking interest
Sponsored Links
    #6  
Old 04-29-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
 
Join Date: Mar 2008
Last Activity: 28 March 2011, 6:41 AM EDT
Location: /there/is/only/bin/sh
Posts: 3,653
Thanks: 0
Thanked 10 Times in 8 Posts
exec in this form is for redirecting the file descriptors of the process.

Think of it this way; if you always want to do "myscript 2>/tmp/fnord 1>&2" then you can say this inside myscript, right at the beginning:


Code:
exec 2>/tmp/fnord 1>&2

Then the redirections are no longer needed at the prompt when you run myscript.

So in your example, the script's input file descriptor (what every command will be reading from if not given a file argument -- read, cat, grep, you name it) from that point on is /dev/console, output from all commands will go to /dev/console (unless separately redirected, of course), and errors will go to the same (2>&1 means send standard error where-ever standard output is).
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
passing command output from one command to the next command in cshell kaaliakahn UNIX for Dummies Questions & Answers 2 02-10-2012 04:59 PM
unix command : how to insert text at the cursor location via command line? xib.be UNIX for Advanced & Expert Users 0 12-22-2010 05:45 PM
Need help! command working ok when executed in command line, but fails when run inside a script! 4dirk1 Shell Programming and Scripting 4 12-02-2010 05:47 AM
awk command in script gives error while same awk command at prompt runs fine: Why? catalys Shell Programming and Scripting 4 09-20-2010 10:07 PM
awk/sed Command : Parse parameter file / send the lines to the ksh export command rajan_san Shell Programming and Scripting 4 11-06-2008 12:29 PM



All times are GMT -4. The time now is 07:57 PM.