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 is cmake in linux?
What command you execute to display the last five commands you have entered?
Which command is used to clear the screen?
You suspect that you have two commands with the same name as the command is not producing the expected results. What command can you use to determine thelocation of the command being run?
What is kill 9 in linux?
What is nslookup command?
Can I delete .bash history?
Working in Linux/Unix platform, if any command dose not work, say # ls reports as command not found. what to do?
how many hard disks can i able to connect to desktop pc and server (IDE & SATA) pls send this ans to my mail : ping2pavan@gmail.com
How many linux commands are there?
What does sh do in linux?
What is clang format?