LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-25-2002, 12:59 AM   #1
juno
Member
 
Registered: Sep 2002
Location: fdas
Posts: 100

Rep: Reputation: 15
Disable error message


When use 'ls' to list a not available file (eg. `ls testfile` ) , then it would pop up error message `testfile not found ' , how can i disable such error message (except output the error to null value ( 2 > /dev/null ) ? Thanks.
 
Old 09-25-2002, 01:45 AM   #2
RijilV
Member
 
Registered: Sep 2002
Location: somewhere
Distribution: gentoo
Posts: 123

Rep: Reputation: 15
#!/bin/bash
if test -x [filename]
then
ls [filename]
fi

if you are doing something else, other than just no enjoying seeing the ls: asdf: No such file or directory message display, such as piping data from tither to thither, like

ls foo | grep -e "bar"

then
ls foo 2>/dev/null | grep -e "bar"

will still display error messages from grep
if you are just using ls to test if a file is there, there is a better away...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable the error message pop to screen ust Linux - Distributions 1 04-15-2005 07:30 AM
QMAIL error:554 Transaction failed: message format error mpk25 Linux - Software 1 10-15-2004 12:53 PM
error message when run MRTG: SNMP error zhgalaxy Linux - Newbie 0 02-18-2004 12:08 PM
Disable SSH access but show a message fr0st Linux - General 6 12-16-2003 07:50 AM
how to disable the "you have new mail" message? ry Linux - General 9 04-23-2003 06:18 AM


All times are GMT -5. The time now is 07:22 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration