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 |
How do you check the current system uptime in Linux?
What is phony in makefile?
What does (cd dir && command) do?
How to block the message in wall command some students are send messages to all in the lab. please help me
How use linux command line?
What is the purpose of the 'chmod' command?
To move /home/ben/memos dir in /home/bob/memos, what is the result by mv /home/ben/memos /home/bob
Explain any one service which are working on udp only?
Is makefile a shell script?
How will you suspend a running process and put it in the background?
What is a ulimit in unix?
What are bash scripts used for?