The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script to execute user command redtiger Shell Programming and Scripting 1 04-30-2008 06:53 PM
execute shell command in perlscript amitrajvarma Shell Programming and Scripting 0 11-27-2007 02:49 AM
become SU - ...Silently systemali Shell Programming and Scripting 9 03-27-2006 10:40 AM
Plz Help : How to use write command to execute command on some other terminal Aashish UNIX for Dummies Questions & Answers 2 03-03-2006 12:25 PM
Urgent!! How to write a shell program to execute command to access internet? firebirdonfire UNIX for Dummies Questions & Answers 2 04-26-2001 11:16 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-15-2007
lumix lumix is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 15
execute a command silently or quietly within a shell

How do I suspend output of commands and tools that sometimes utter unwanted output? I know that I can always pipe to null or some such thing, but is there a simpler more elegant (i.e. accepted) practice?
  #2 (permalink)  
Old 12-15-2007
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,913
Some commands and tools have options for silent mode. However the accepted practice is to send stderr to /dev/null.
  #3 (permalink)  
Old 12-15-2007
lumix lumix is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 15
I really have to learn to phrase more carefully. I didn't mean to imply error output, but really just the FYI kind of messages that might complement the actual work or output of a tool. Something like "...done. 5 instances found", where the work was desired, but the chit chat wasn't.

If I remember correctly, in DOS this was accomplished by preceding the statement with an apostrophe. Now it's done by "echo off".

Thanks for the reply, btw.
  #4 (permalink)  
Old 12-15-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Some commands have quiet/verbose mode, check what commands are being used. The tradition is that tools are quiet unless told to be verbose.

What command is it that is outputing the unwanted blurb?
  #5 (permalink)  
Old 12-15-2007
prowla prowla is offline
Read Only
  
 

Join Date: Nov 2007
Posts: 165
A process normally has two outputs to screen: stdout (standard out), and stderr (standard error).

Normally informational messages go to sdout, and errors and alerts go to stderr.

You can turn off stdout for a command by doing

Code:
mycommand >/dev/null
and turn off stderr by doing:

Code:
mycommand 2>/dev/null
If you want both off, you can do:

Code:
mycommand 2>&1 >/dev/null
(The 2>&1 says send stderr to the same place as stdout.)

Turning around the notes about the "-v" for verbose convention; some commands have a "-q" (quiet) option, eg. "grep -q".
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0