Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 18th, 2012, 12:46 AM
rcorn7 rcorn7 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 2 rcorn7 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 51 sec
Reputation Power: 0
KSH error redirection

I am using a Linux variant by the name of OpenSUSE

anyways, this is actually for school and im really confused by a lab question i am dealing with. Perhaps someone can help me and educate me in the process. and ps this is in ksh

Q. Enter the following command: badcommand > outfile 2>&1 ; ls > outfile 2>&1.
View the outfile file. Why isn’t the error output from the “badcommand” command in the outfile?

My answer
ksh: badcommand: not found [No such file or directory] .

How would you change the previous command to get BOTH the badcommand error output AND the ls output to the outfile file? Enter the command here after you have verified that it works:


this is where i am a little confused, what is happening is that im able to redirect the ls information to outfile, but i repeatedly have issues with badcommand not found etc.

And hints or tips? stumped here.
.

Reply With Quote
  #2  
Old July 18th, 2012, 01:24 AM
rcorn7 rcorn7 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 2 rcorn7 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 51 sec
Reputation Power: 0
Well before anyone could reply I realized the solution was to go
badcommand >> outfile 2>&1 ; ls >> outfile 2>&1

So simple, glad i figured it out on my own however.

Reply With Quote
  #3  
Old July 18th, 2012, 06:28 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,108 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 4 h 41 m
Reputation Power: 1485
Well done for working it out yourself.
One thing, you don't really need the append (>>) file redirection on the first command, unless you wish to preserve previous output to that particular logfile (outfile).
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > KSH error redirection

Developer Shed Advertisers and Affiliates



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap