UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX 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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 27th, 2004, 06:42 PM
unix_student unix_student is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 4 unix_student User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
output to file - ksh

How do I send the output of the following command to a file?
uname -sr

I tried "uname -sr > filename" but it doesn't work. It still displays the result of "uname -sr" on the screen and the file is blank.

Thanks.

Reply With Quote
  #2  
Old October 28th, 2004, 06:46 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 44 m 45 sec
Reputation Power: 9
typo ?
if you enter
uname -sr >xxx
the output goes to 'xxx'
but typing
uname -qwerty >xxx
the output goes to stderr and xxx is empty
does your uname supports the options [sr] ?

Reply With Quote
  #3  
Old October 28th, 2004, 08:28 AM
unix_student unix_student is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 4 unix_student User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes, my uname supports -sr and all of the other options that come with. I just don't get why the result goes to standard output instead of the file. All of the other file redirections work fine.

Reply With Quote
  #4  
Old October 28th, 2004, 11:06 AM
Perderabo Perderabo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 121 Perderabo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 54 sec
Reputation Power: 5
What version of unix are you using? Does "uname -sr > file 2>&1" work any better? What does "whence uname" say?

Reply With Quote
  #5  
Old October 28th, 2004, 07:30 PM
unix_student unix_student is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 4 unix_student User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks Perderabo.

uname -sr > file 2>&1 worked.

Thanks again.

Reply With Quote
  #6  
Old October 28th, 2004, 09:39 PM
Perderabo Perderabo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 121 Perderabo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 54 sec
Reputation Power: 5
You're welcome, but I must say that you are using an odd system. That "2>&1" is usually not needed with uname. I would still like to know what version of unix you're using.

Reply With Quote
  #7  
Old November 2nd, 2004, 04:13 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 44 m 45 sec
Reputation Power: 9
on the commad line:
uname -what-you-want >filename
MUST work
if not, you have a probl with the sys (call the sys-adm)

when you do that in a script:
you accidentally (or not) closed the stdout-fd

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > output to file - ksh


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway