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 |
Which command is used to review boot messages?
What is nbtstat command?
What does in makefile do?
How do I check my cpu speed?
Explain trap command of linux?
If the programmer wishes to execute an instruction at the specified time. Which command is used?
1. Why "d" is postfix in almost every service name of Linux like httpd, dhcpd? 2. how to restrict su & ssh services for some users? 3. how can we configure a default gateway for 10 n/w cards in a server?
What does comm do and how to use it?
What is history command in linux?
Why is it called bash?
What is the copy command in linux?
What is make command in linux?