On 11/05/2016 01:51 AM, Richard Owlett wrote: > Today I've been having weird problems executing scripts. > As I have no valuable data on the partition containing Debian, I > wiped it and did a fresh install of Debian Jessie (8.6.0) MATE > desktop environment from a purchased set of DVDs. Earlier today I had > had reason to create an *,iso of DVD1 of 13 using xorriso. The ISO > had a MD5SUM matching the one at debian.org . > > More than a half-century of trouble shooting *screams* 'operator error' ;[ > But what????? [Caja reports the execute bit is set ;] > > Cut-n-paste from MATE terminal: > root@full-jessier:~# #!/bin/bash -x > root@full-jessier:~# cd /media/root/myrepo > root@full-jessier:/media/root/myrepo# RCO > bash: RCO: command not found
By default for security reasons the current directory is not in the PATH environment variable on Linux. Perhaps in your previous install you had manually added it to your environment, but in a fresh installation with an empty home directory (or at the very least without restoring dotfiles in your home directory) it will not be present. You can add it to PATH via: export PATH=$PATH:. in the current shell. You can also add that line to your ~/.bashrc to make that permanent. (Note that you appear to be running this as root, so ~ means the home directory of the root user here, typically /root.) Please be aware of the security implications of this though; while adding it to the end of PATH (as my line above does) is not quite as bad as adding it in the front, this could lead you to potentially running programs from untrusted sources. (Example scenario: you have a command line open in a directory which contains an executable or a script with the name of something you want to execute, you accidentally removed the command a month ago during a system update; in that case typing in that command will execute the binary/script from the current directory - and if the current directory comes from an untrusted source, because it's on an external pendrive that you don't trust, for example, then it could lead you to executing malicious code.) Alternatively, what most people do is not add the current directory to PATH explicitly. Because there's another way to call a script or binary from the current directory, by explicitly telling the shell what you want - in this case by prepending './'. In your case, you can do ./RC0 and that will execute the script "RC0" in the current directory. It will also be explicit that you are executing something from the current directory and not a system command - which is why I prefer to do it this way instead of tinkering with PATH here. As a side note: your script RC0 doesn't appear to start with a shebang line. In that case the script will be executed via /bin/sh, so it will work regardless, but I would suggest to make that explicit by having the script start with #!/bin/sh. (Or #!/bin/bash if you need bash features in the script.) Regards, Christian