Why does bash <command>
fail to run?
$ bash date
/bin/date: /bin/date: cannot execute binary file
$ /bin/date
Fri Mar 18 05:59:24 EDT 2016
$ bash -c date
Fri Mar 18 06:00:39 EDT 2016
bash
Why does bash <command>
fail to run?
$ bash date
/bin/date: /bin/date: cannot execute binary file
$ /bin/date
Fri Mar 18 05:59:24 EDT 2016
$ bash -c date
Fri Mar 18 06:00:39 EDT 2016
Best Answer
From the manual:
So
bash date
means "read thedate
file and execute the shell commands it contains". Assuming there is nodate
file in the current directory,bash
searches the path and finds/bin/date
which is a binary rather than a shell script, hence the error.