- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- what is >&2?
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
06-10-2004 06:17 AM
06-10-2004 06:17 AM
I know what 2> is
and 2>&1
But what is >2&
What would >2& do in
echo "Hello" >2&
Solved! Go to Solution.
- Tags:
- redirect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2004 06:22 AM
06-10-2004 06:22 AM
Re: what is >&2?
So echo "Hello" >2&, would not produce any output.
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2004 06:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2004 06:30 AM
06-10-2004 06:30 AM
Re: what is >&2?
As Sri indicated the command ending with >2& will send stdout to a file called 2 and do it in the background.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2004 06:32 AM
06-10-2004 06:32 AM
Re: what is >&2?
In the solutions section for each chapter there is a script (mycp) that mimicks the cp command but a bit more comprehensive.
Anyway the script includes several >2&.
Here is the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2004 06:32 AM
06-10-2004 06:32 AM
Re: what is >&2?
The & at the end means run in background...
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2004 06:34 AM
06-10-2004 06:34 AM
Re: what is >&2?
I tried it, and it looks like it just redirects standard output to standard error.
I used this command and got these results:
# fuser /sbin/sh >&2
/sbin/sh: 2018mt 4204mt
The output came back to the screen and it didn't try to run in background.
Now, if you wanted to redirect standard output to a file, and also redirect standard error to standard output (to that same file), you can do this:
# fuser /sbin/sh >/var/tmp/sh.txt 2>&1
# cat /var/tmp/sh.txt
/sbin/sh: 2018mt 4204mt
The 'fuser' command is a good one to try because the process IDs go to standard output and the flags go to standard error.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2004 06:37 AM
06-10-2004 06:37 AM
Re: what is >&2?
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2004 06:45 AM
06-10-2004 06:45 AM
Re: what is >&2?
Another point, is that it is strange for a book to use this when people more oftenly use 2>&1 than >&2, which seems to me more natural.
regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2004 07:15 AM
06-10-2004 07:15 AM
Re: what is >&2?
&> file and >& filename are both equivalent to 2>&1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2004 08:10 AM
06-10-2004 08:10 AM
Re: what is >&2?
I thought it was a typo but then I thought it can't be.
Well it looks like a typo.
thanks for the swift responses.