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 |
When and how linux developed?
What are some popular Linux distributions?
Did you work with linux? What flavors and versions?
Which Command used to lock user password in Linux?
Which commands are used to set a processor-intensive job to use less cpu time?
What are the basic dos commands?
How do I know my shell?
What is the command to check cpu speed in linux?
What is the best cpu stress test?
How many linux commands are there?
What is cpu utilization linux?
when i create SAMBA server it is ok but while i try for access from windows pc he ask me only first time smb password then i close samba login next time he can`t ask for passwd why.?