- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Redirecting output to a file and terminal
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
Forums
Discussions
Discussions
Discussions
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
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
03-28-2001 05:21 PM
03-28-2001 05:21 PM
I would like to redirect the output to the terminal and a file and the error to the error file. This is what I was trying. But the output is never displayed on the screen.
echo "abcd" > aa 2>&1
I want simultaneously the output to be stored in the file and displayed on the terminal.
I am using ksh
Thanks in advance
Bala
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2001 05:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2001 06:14 PM
03-28-2001 06:14 PM
Re: Redirecting output to a file and terminal
You could try the "script" command which would direct all your terminal output to a file without hiding it.
eg.
script outfile.txt
script off
cat outfile.txt
Rgds,
Philip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2001 07:53 PM
03-28-2001 07:53 PM
Re: Redirecting output to a file and terminal
echo "abcd" | tee aa 2>&1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2001 11:58 PM
03-28-2001 11:58 PM
Re: Redirecting output to a file and terminal
I didn't test what the other authors proposed to do. Here is what I found how to get what you want:
(date;date -x) 2> buf2 | tee buf
'buf2' contains stderr while stdout appears on the terminal and is written to 'buf'. See the man page of tee for some options.
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2001 08:21 AM
03-29-2001 08:21 AM
Re: Redirecting output to a file and terminal
|tee -a (-a for append).You can see man tee.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2001 09:27 AM
03-29-2001 09:27 AM
Re: Redirecting output to a file and terminal
===============
$ echo err | tee -a errfile 2>&1
err
$ echo err2 | tee -a errfile 2>&1
err2
$ cat errfile
err
err2
$
===========
- fnhalili