| | |
How not to show messages?
Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Aug 2009
Posts: 17
Reputation:
Solved Threads: 0
Hi all
I just have questions about
how not to show messages after you execute a certain command.
for example whenever you execute "which xxx"
there will always be a message on the terminal
saying its path or command not found will be written.
is that possible to write a shell script file
without showing these kind of messages?
Thanks!
I just have questions about
how not to show messages after you execute a certain command.
for example whenever you execute "which xxx"
there will always be a message on the terminal
saying its path or command not found will be written.
is that possible to write a shell script file
without showing these kind of messages?
Thanks!
Send stdout and stderr to /dev/null:
You can still access the return value which is usually why this is done. Here is an example:
bash Syntax (Toggle Plain Text)
sk@sk:~$ which bash /bin/bash sk@sk:~$ which bash >> /dev/null 2>&1 sk@sk:~$
You can still access the return value which is usually why this is done. Here is an example:
bash Syntax (Toggle Plain Text)
sk@sk:~$ which bash >> /dev/null 2>&1 sk@sk:~$ echo $? 0 sk@sk:~$ which asoija0cjas9cuasc >> /dev/null 2>&1 sk@sk:~$ echo $? 1
•
•
Join Date: Aug 2009
Posts: 17
Reputation:
Solved Threads: 0
Thank you very much
problem solved!
problem solved!
•
•
•
•
Send stdout and stderr to /dev/null:
bash Syntax (Toggle Plain Text)
sk@sk:~$ which bash /bin/bash sk@sk:~$ which bash >> /dev/null 2>&1 sk@sk:~$
You can still access the return value which is usually why this is done. Here is an example:
bash Syntax (Toggle Plain Text)
sk@sk:~$ which bash >> /dev/null 2>&1 sk@sk:~$ echo $? 0 sk@sk:~$ which asoija0cjas9cuasc >> /dev/null 2>&1 sk@sk:~$ echo $? 1
![]() |
Similar Threads
- another c++ problem: doesnt show messages (C++)
- Text not scrolling to last message (JavaScript / DHTML / AJAX)
- Windows not loading black screen. (Windows NT / 2000 / XP)
- Cant find right Message handle. (C++)
- How do i get cin.getline to timeout? (C++)
- IE problem with webmail (Web Browsers)
- Favorite keyboard and mouse (Geeks' Lounge)
- enable gmail pop (Python)
- Buffer Overflow Protection - McAfee (Viruses, Spyware and other Nasties)
- Having a problem trying to install CGI::Session on Mac OS X (Perl)
Other Threads in the Shell Scripting Forum
- Previous Thread: how to prevent user close window during script execution?
- Next Thread: Issue with sed and date variable - Suffix too large - 512 max
| Thread Tools | Search this Thread |
Tag cloud for Shell Scripting






