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 the command to uninstall processes in linux?
17 Answers Aegon, HCL, IBM, Ugam Solutions,
what is linux utilities and editor
What does kill in linux?
How do I check cpu usage?
What is bc command in unix?
what is "ls* " is run options are 1) x 2).x 3) hidden 4) no disply tell exact answer.
What is a ulimit in unix?
How do you insert comments in the command line prompt?
You have a computer with 80 GB hard disk and Ubuntu 8.04 is installed on entire hard disk. Now you have to create a seprate partition for Windows OS and Install Win Xp as Dual boot. write down the steps involed along with the commands.
8 Answers Bhel, Indian Navy, Tata Steel Limited,
How can we increase disk read performance in single command in Linux?
How do I navigate in cmd?
Who is unix command?