This means that you are trying to execute a binary file using your bash script which is not intended to be run as you trying it to be. It is already a binary file and you are trying your $SHELL to parse and run it.
in a very simple example, if you try to run `w' command like
$ bash w
/usr/bin/w: /usr/bin/w: cannot execute binary file
similarly you might be hitting the same method or as it looks from your code snippet.
While , for the remaining for your commands, Al these halt, shutdown , reboot etc commands are the root owned commands and need super-user prilveges to run and perform the required operation. normal users can't run them
another explanation is that these commands are placed at /sbin/ and /usr/sbin , which might not be in your $PATH variable ( which is used to validate commands in your custody )
PATH
is an environment variable which contains a list of folders which the shell searches for programs.ls
for example, usually refers to/bin/ls
, and your shell finds it by going through the folders listed inPATH
one-by-one until it finds it, or if it doesn't find it in any of them, it gives up. I suppose a better starting point would be, what is the output ofecho $PATH
? (edit: theexport
command is a way to define an environment variable in bash.)export PATH=/bin:/user/bin:/sbin:/usr/sbin
. It's a silent command.