- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Explain some script lines to me please.
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
тАО06-12-2004 08:17 AM
тАО06-12-2004 08:17 AM
mount -p | grep -E '/snapshot' > /dev/null
Why put the stdout to /dev/null? Is it in case the mount command fails?
same here:
mt -t $TAPE rew 2> /dev/null
Will this mt command produce a stderr? Or is it in case the command fails?
one more please
2) mailx -ms "`hostname` `date` Oracle Backup FAILED" < /dev/null $MAILADDRESS
Why is there input from /dev/null?
Thanks.
I don't want to create a tutorial on scripting on this forum but the curiosity is killing me!
Solved! Go to Solution.
- Tags:
- redirect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2004 08:32 AM
тАО06-12-2004 08:32 AM
Re: Explain some script lines to me please.
Why put the stdout to /dev/null? Is it in case the mount command fails?
well, it is going to be hard to explain one line of a script without the context it is being used.
but in this case the grep command will output the lines that it does match. it would guess that the script isn't interested in which lines match, i.e. dump the output, and is concerned with weather there is a match or not. in which the case the next lines of the script probably test the return code of the grep command. true if there is a match, false if there isn't. And, if the grep command does send something to stderr it will be output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2004 08:51 AM
тАО06-12-2004 08:51 AM
SolutionWill this mt command produce a stderr?
yes the command could produce an output to stderr, just that the error is never going to be seen or used.
Or is it in case the command fails?
without context it can't be determined. one would suppose that stderr is sent to dev/null because whoever wrote the script thought it wasn't necessary for the message to be output.
the mt command can be used in many ways. the script could be just taking a precaution to always rewind the tape before a backup. spending a few seconds rewinding a tape that is already rewound, isn't as time consuming as trying to restore from a tape with multiple volumes written to it.
then again the script could be rewinding the tape to see if the device is ready. in which case the error message isn't needed by the script, just weather the command succeeded or not. in which case the script will test the return code of the command, not what the error message was.
- Tags:
- mt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2004 08:58 AM
тАО06-12-2004 08:58 AM
Re: Explain some script lines to me please.
Why is there input from /dev/null?
mailx requires a mail message. you can't just mail a subject line. so to specify an emmpty file you use /dev/null. it is easier then creating a empty file to specify for the mail message then removing it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2004 10:56 AM
тАО06-12-2004 10:56 AM
Re: Explain some script lines to me please.
The script does check for the return code! i.e. by using $?
For the mailx thanks for clearing that one up.