•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,442 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,626 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 1495 | Replies: 10
![]() |
•
•
Join Date: Oct 2007
Posts: 306
Reputation:
Rep Power: 2
Solved Threads: 29
Hey Dave,
I'm using ">/dev/null 2>&1" after grep in my script so no output will go to the screen from the grep command.
In the if loop, I'm checking the value of $? "errno - or the return code" - grep returns 0 if it's a success. The check needs to come right after the grep command is executed, because the $? variable gets populated with the return code (or error number) of whatever command was run last.
Hope that helps explain
, Mike
I'm using ">/dev/null 2>&1" after grep in my script so no output will go to the screen from the grep command.
In the if loop, I'm checking the value of $? "errno - or the return code" - grep returns 0 if it's a success. The check needs to come right after the grep command is executed, because the $? variable gets populated with the return code (or error number) of whatever command was run last.
Hope that helps explain

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Clean Previous Next Script for MySQL results (PHP)
- The name for the Resize Button to ad to Script (HTML and CSS)
- Random Programming Script (Computer Science and Software Design)
- Importing SQL Script File - Urgent !! (Database Design)
- Script problems with IE (Web Browsers)
- Help with shell script to auto gzip a .sql dump after backup (Shell Scripting)
- Adding mutiple PC's to an OU via script? (Windows NT / 2000 / XP / 2003)
- Table of Contents Script (Java)
- ASP slow-down server script (ASP)
Other Threads in the Shell Scripting Forum
- Previous Thread: shell script
- Next Thread: need help with figuring out sizeof in bash script


Linear Mode