Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

More on LinuxToday


Linux Commands: Making Bash Error Messages Friendlier

Apr 01, 2010, 13:32 (0 Talkback[s])
(Other stories by Carla Schroder)

"The command line! The bane of the novice Linux user! It's so useful -- yet it can be challenging to learn.

"The error messages don't help much. "Command not found." "Permission denied." As a newbie, you need to know more. Isn't that the right command? Why was permission denied? How are you to figure out what the real problem was? And why can't the shell help you with that?

"Ubuntu has taken some steps in that direction already. They've set up the bash shell so that if you get "Command not found", most of the time you'll also see suggestions on what you might have meant: commands that are spelled similarly, or commands that aren't installed along with which package you need to install to get them. It looks like this:

$ catt /etc/fstab
No command 'catt' found, did you mean:
Command 'cat' from package 'coreutils' (main)
Command 'cant' from package 'swap-cwm' (universe)
catt: command not found

"It's an excellent step. Perhaps still not 100% clear -- you still need to know what those packages are and how to install them -- but it's a good start!

"But what about other errors, like the all too common "Permission denied"? Ubuntu's error handling uses a function built into bash for that specific purpose, a function called command_not_found_handle that can't be used for other types of errors."

Complete Story

Related Stories: