Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How do display error messages instantly when command fails?

Answer Posted / ajit mohan b

Suppose you are trying to cat a non existing file:

cat /etc/shado 2>/dev/null || echo “Failed to open file”

command 2 "echo" is executed only if command 1 "cat" returns
a non-zero exit status

# cat /etc/shado 2>/dev/null || echo "Failed to open file"
Failed to open file
#

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What command do you type to find help about the command who?

908


What is tail command in linux?

983


What is a good processor speed?

891


What does chmod 644 do?

954


What is mkdir p linux?

1009


You have a tab delimited file called phonenos and want to change each tab to four spaces. What command can you use to accomplish this?

995


What is makefile in unix?

989


What are two functions the move mv command can carry out?

1020


How often do you use grep command and how in Linux operating system?

1047


How use linux command line?

1025


Which command is used to find what is in your home directory?

936


Enlist some linux to file content commands?

993


What is a ulimit in unix?

982


why context switching time should be minimum? How it depends on hardware support?

1739


What is the purpose output of cd command?

992