The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
ksh: cmd output to input of another script IMTheNachoMan Shell Programming and Scripting 2 04-27-2008 09:58 AM
Shell script getting input from output aspect_p Shell Programming and Scripting 1 03-11-2008 07:37 AM
log script input and output using tee ? moseschrist Shell Programming and Scripting 0 11-12-2006 03:32 AM
input redirection question luistid Shell Programming and Scripting 0 08-22-2006 07:28 AM
Input Redirection majeed73 UNIX for Dummies Questions & Answers 6 07-08-2002 03:57 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-17-2006
trivektor trivektor is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 8
Asking about shell script input output redirection

Hi,

Can anyone please tell me what these lines do?

ls >& outfile

ls outfile 2>&1

Thanks.
  #2 (permalink)  
Old 10-18-2006
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
Code:
ls >& outfile
output of ls command is redirected in a file named outfile


ls outfile 2>&1
if a file named outfile exists, then it is listed, and along with it, errors (represented by 2) are redirected to standard output (represented by 1), but that isn't useful in this case, you would have got any error on your terminal anyway.

if file outfile does not exist, then you will get message:
ls: newfile: No such file or directory
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:22 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0