- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Redirection in csh
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2004 01:28 AM
тАО08-23-2004 01:28 AM
Redirection in csh
Could any one explain (or redirect) me to know more about Outpur redirection in C Shell. I want both error and regular output to be written into a file and should also display at the Standard Output.
Thanks in Advance,
-Parmy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2004 02:11 AM
тАО08-23-2004 02:11 AM
Re: Redirection in csh
the nearest you can get is something like: -
touch log ; tail -f log & ; your_command >& log
This should give an idea of the inflexibilities of the csh, in various areas: -
http://www.ooblick.com/text/CshProgrammingConsideredHarmful.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2004 01:43 AM
тАО08-24-2004 01:43 AM
Re: Redirection in csh
You can also use the 'tee' command. Check out man tee(1).
In my scripts, I'll check if it is interactive, and if so, then I'll pipe the output throught tee. In this way, the user gets to see the output on the screen, and the output is also being saved in a log file.
Something like this:
ls -l /etc | tee /tmp/logfile.log
Regards,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2004 01:49 AM
тАО08-24-2004 01:49 AM
Re: Redirection in csh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2004 03:52 AM
тАО08-24-2004 03:52 AM
Re: Redirection in csh
Redirection can be done based on the output type weather on STDOUT (output mode ) and STDERR ( error mode).
File descriptor 1 is used for standard ouput and 2 is for standard error.
hostname 1> /tmp/hostname.file
hostname output will be redirected to /tmp/hostname.file
IF you want to write output and error in on same file then,
-- file.csh --
hostname
trr
--------------
# csh file.csh 1>/filenamewithpath 2>&1
It will redirect all output / error to that file or
# csh file.csh 1>/filenamewithpath 2>/filenamewithpath
You can also use aslike as,
# csh file.csh 1>>/filenamewithpath 2>>/filenamewithpath
Difference between >> and > is
>> - it will append contents or create new file and add more contents
> - it will create or make null the existing file
HTH.
+Muthu+
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2004 02:17 AM
тАО08-25-2004 02:17 AM
Re: Redirection in csh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2004 02:29 AM
тАО08-25-2004 02:29 AM
Re: Redirection in csh
another command be used for this as script
script test.log
hostname
uname -a
exit
cat test.log will contain your log informations there.
-muthu