How do display error messages instantly when command fails?
Answers were Sorted based on User's Feedback
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 |
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 |
What are two functions the move mv command can carry out?
What is 9 in kill?
What is pwd in linux command?
Explain about gzip filename?
You need to see the last fifteen lines of the files dog, cat and horse. What command should you use?
I lost a root password and i need to give it, I treid to change it through single usermode even though i am not get a password, then what is the other procedure to give a root password?
How to check load balance using linux command?
What is grep command?
What are runlevels in linux?
What is build process?
which command is used to see all the system configuration? like hardware, HDD, memory etc.
14 Answers ADS, eClinicalWorks, NJN,
why do u want to join this company
6 Answers HCL, Infosys, United Healthcare, Wipro,