Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I replace "bash: $COMMAND: command not found" message?

Any help would be appreciated.

Basically, I want to replace:

~]$ obvfake
bash: obvfake: command not found

With:

~]$ obvfake
[*] command not found

Thanks.

like image 201
Carlos Sanchez Avatar asked Mar 17 '14 05:03

Carlos Sanchez


People also ask

How do I fix bash command not found?

Sometimes when you try to use a command and Bash displays the "Command not found" error, it might be because the program is not installed on your system. Correct this by installing a software package containing the command.

How do I replace text in bash?

The 'sed' command is used to replace any string in a file using a bash script. This command can be used in various ways to replace the content of a file in bash. The 'awk' command can also be used to replace the string in a file.

How do you replace a sentence in Linux?

Find and replace text within a file using sed command Use Stream EDitor (sed) as follows: sed -i 's/old-text/new-text/g' input. txt. The s is the substitute command of sed for find and replace.

What is $@ in bash?

bash [filename] runs the commands saved in a file. $@ refers to all of a shell script's command-line arguments. $1 , $2 , etc., refer to the first command-line argument, the second command-line argument, etc.


1 Answers

bash version 4 introduces a hook for handling missing commands; add the following to your .bashrc file.

command_not_found_handle () {
    printf "[*] command not found\n"
    return 127
}
like image 156
chepner Avatar answered Oct 21 '22 15:10

chepner