also when I launch I want to pass path to folder when located these .sh files
I started with this
#!/bin/bash
find /home/user_name -name "*.sh"
And after script has to write in logo list with executable files
Make the scripts executable: chmod +x $HOME/scrips/* This needs to be done only once. Add the directory containing the scripts to the PATH variable: export PATH=$HOME/scrips/:$PATH (Verify the result with echo $PATH .) The export command needs to be run in every shell session.
The safest and way both in terms of security and in terms of weird file names (spaces, weird characters, and so forth) is to use find
directly:
find /home/user -name "*.sh" -execdir chmod u+x {} +
You can check the comments and the manual of find why this is safe, but in short, it makes sure your file is properly quoted in the chmod
command. execdir
(rather then -exec
) is an extra security feature making sure the command is executed in the directory the file was found in avoiding race conditions (elaborated in the manual).
another way :
find . -name "*.sh" -exec chmod ux+y {} \;
you can first check your command by using
find . -name "*.sh" -print
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With