Linux bash script to ignore '$' Many times I have copy and pasted from a guide that had the following instruction:

$ echo &quot;Execute xyz&quot;

and would get the error

$: command not found

So I created a bash script to ignore the '$' at the beginning; The solution is as follows:

Put the below script in a file called '$'

vim $


Make it executable

chmod +x $


Add it to your bin

sudo cp $ /usr/bin/$



The script:
#!/bin/bash
eval $@
Cute idea. It's not so simple, though.
For example, compare the outputs of
echo 'a   b'

with
$ echo 'a   b'

(because of word splitting).
Also, it fails for compound commands like
for i in a b c ; do echo $i ; done

(because everything after the first ; is another command).
Some commands might fail depending on the contents of the current directory, e.g.
$ [[ a = ? ]]

(if it works, try running touch 1 2 3).