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 umask in linux?
Main configuration file and command used for NFS enabling exported directories and deamons?
hi friends how to reinstall the grub.conf file. once i delete the grub file in perminatle ofter how to get back that file. plz send me ans. regards. madhu.m
How many types of commands are there in linux?
How do you create a file?
Explain Backup Managment commands in Linux.
What is Write Command?
How to write the output of a command to a file?
tell me command for" to create more than one name to a file".
What does chmod 644 do?
What is df -i command?
What is the use of man command in linux?