Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide screen output of UNZIP within shellscript

Status
Not open for further replies.

barryp

Programmer
Jan 30, 2002
48
GB
I need to include

if unzip -t file.zip

in a script to test the structure of a ZIP file before proceeding further

I would like to suppress the output "This is not a zipfile" or whatever but

unzip -t file.zip > null doesn't work

What will ??
 
If I understand you correctly you don't want anything displayed on the screen when you run your command i.e. suppress standard error and standard out

unzip -t file.zip > /dev/null 2>&1

tr try it individually

unzip -t file.zip 2>/dev/null ( no errors will be displayed)
1>/dev/null ( no results will be displyed)


HTH

 
THANKS

I was confused by the SAME message output to BOTH stdout & stderr
So 1>/dev/null seemed not to work
and 2>/dev/null same
and just unzip -t file.zip just output ONE copy of the error message

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top