This situation depends on which scripts are in the shell scripting file. For example; Yes, it is dangerous if there is a "delete all files in the directory" command in the Egample.sh
file and you have granted chmod + x
privilege.
rm *
The above command will delete all files in the directory where it is located.
If your goal is to run a sh
snippet with just the filename, without entering sh Egample.sh
then you can use the PATH
feature.
export PATH=$PATH:/file/path
source ~/.bashrc
I recommend you to learn more about File System Hierarchy. Up-to-date information on the FHS standard is available at https://www.pathname.com/fhs/.
You can also create a cron
and run Egample.sh
periodically. Everything is files in Linux and there are many alternatives to doing something. In order to find a suitable alternative, the purpose must be fully explained.
/usr/bin
folder according to filesystem. – Ipor Sircer Oct 29 '20 at 14:43PATH
environment variable includes/usr/bin
in it; which is extremely likely. Do you have security or safety concerns? Does your script include arm -rf *
command? – Mark Stewart Oct 29 '20 at 14:50~/bin
directory and add that to Path, e.g. https://unix.stackexchange.com/questions/131310/add-home-bin-to-path-for-a-single-user-in-debian-wheezy-with-lxde. Then move your file there. – pLumo Oct 29 '20 at 15:20/bin
VS/usr/bin
is a different issue; they can be seen as equivalent in this case). – fra-san Oct 29 '20 at 18:20