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?

Answers were Sorted based on User's Feedback



How do display error messages instantly when command fails?..

Answer / rallapalli

HE did not ask how to redirect error of a command. He said
clearly. How do you display error message instantly when
command fails.

ans:
By default it will display no need to do any thing. when u
type wrong command the error will display on screen.
Ex:
#usradd tom
ERR: command not found

ok?

Is This Answer Correct ?    7 Yes 0 No

How do display error messages instantly when command fails?..

Answer / 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

More Linux Commands Interview Questions

What is difference between sh and bash?

0 Answers  


When and how linux developed?

0 Answers  


Why we use pwd command in linux?

0 Answers  


What is Syntax of any Linux command?

0 Answers   UGC Corporation,


What is the command to see on which port which service is running? And what is the difference between /etc/services file and net stat command?

0 Answers  


how do you configure linux system as a router?

5 Answers   HP,


What does && mean in bash?

0 Answers  


what command would you use to find the hostname of the server if yo ony have the ip address?

10 Answers  


how to create SAMBA server in fedora 9 linux ?

6 Answers   Wipro,


Explain about refer?

0 Answers  


what is snmp and for what purpose we are using in linux

4 Answers  


What is mask and umask in linux?

0 Answers  


Categories