- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: What does &- mean?
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
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
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
тАО04-19-2002 01:38 AM
тАО04-19-2002 01:38 AM
Recently I saw a command line,
remsh remotesp /tmp/test1.sh 2>&- \;/tmp/test2.sh > logfile
can anybody tell me why use "&-" and "\;" here?
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 01:44 AM
тАО04-19-2002 01:44 AM
Re: What does &- mean?
Form the man page of sh-posix(1):
>&- The standard output is closed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 01:46 AM
тАО04-19-2002 01:46 AM
Re: What does &- mean?
>&- The standard output is closed.
\; rest of the line is still part of the remsh command and not a new command of the same shell.
Hartmut
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 01:51 AM
тАО04-19-2002 01:51 AM
Solution0 is the file descriptor for stdin (standard input)
1 is the file descriptor for stdout (standard output)
2 is the file descriptor for stderr (standard error)
2>&1 means redirect stderr to stdout so that all your errors will be redirected to the standard output of your current tty.
&- with > redirects the output be it from stdout or stderr to null ("/dev/null") so that nothing is displayed on your current tty.
>&- or 1>&- redirects the stdout to null.
2>&- redirects the stderr to null.
\; is to dereference the ; symbol so that it will not be interpreted by the shell as a separator between two different command lines. This ensures that ; is treated as part of the command line.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 01:52 AM
тАО04-19-2002 01:52 AM
Re: What does &- mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 01:57 AM
тАО04-19-2002 01:57 AM
Re: What does &- mean?
In general, if you replace &- with &1, then your stderr will be redirected to your stdout which is subsequent redirected to your logfile in your command via >.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 02:01 AM
тАО04-19-2002 02:01 AM
Re: What does &- mean?
How can I create logfile on remote server?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 02:06 AM
тАО04-19-2002 02:06 AM
Re: What does &- mean?
will create the logfile on your local host.
To create it on the remote machine, use cmd ">" logfile.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 02:09 AM
тАО04-19-2002 02:09 AM
Re: What does &- mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 03:05 AM
тАО04-19-2002 03:05 AM
Re: What does &- mean?
the >&2- just closes stderr.
the \; has the effect, that the following commend will be executed remotely. If you ommnit the \ only the first command will be executed remotely.
To get the logfile on the remote machine you only have to escape with \ the redirection:
remsh remotesp /tmp/test1.sh 2>&- \;/tmp/test2.sh \> /tmp/logfile
I recommend to use an absolute path for the logfile to find it easier.
The alternatve is to put all things that has to be remotely in quotes:
remsh remotesp "/tmp/test1.sh 2>& ; /tmp/test2.sh > /tmp/logfile"
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2003 02:09 AM
тАО05-22-2003 02:09 AM
Re: What does &- mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2003 02:09 AM
тАО05-22-2003 02:09 AM
Re: What does &- mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2003 02:11 AM
тАО05-22-2003 02:11 AM
Re: What does &- mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2003 07:19 PM
тАО05-22-2003 07:19 PM
Re: What does &- mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2003 07:32 PM
тАО05-22-2003 07:32 PM
Re: What does &- mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2003 07:56 PM
тАО05-22-2003 07:56 PM
Re: What does &- mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2003 08:00 PM
тАО05-22-2003 08:00 PM
Re: What does &- mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2003 08:07 PM
тАО05-22-2003 08:07 PM
Re: What does &- mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2003 11:16 PM
тАО05-22-2003 11:16 PM
Re: What does &- mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2003 11:40 PM
тАО05-22-2003 11:40 PM