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 |
Brief about FTP hostname?
If you have saved a file in linux. Later you wish to rename that file, what command is designed for it?
Who unix commands?
What is build process?
What is env command in linux?
What could possibly be the problem when a command that was issued gave a different result from the last time it was used?
I lost a root password and i need to give it, I treid to change it through single usermode even though i am not get a password, then what is the other procedure to give a root password?
Explain about gzip filename?
Compare between SYS V launched processes and Xinetd processes in Linux.
how do u extract files from iso cd images in linux?
How can I check the exit status of my previous command in Linux operating system?
0 Answers SwanSoft Technologies,
Which are the linux directory commands?