I have a folders containing a bunch of scripts. Suppose the folder is at ~/scripts
Is there a way I can execute those scripts in the directory easily without having to do something like ~/scripts/file1.sh ? I’ve tried putting the scripts in /bin/, but then I’d still have to do file1.sh. Is there a way I can just refer to those scripts by their name, without the extension (ie., file1) ?
Thanks.
Add
~/scriptsto your PATH env variable either in .profile, .bashrc or on command line itself. Use following command to change your PATH env variable:Once that is done make sure your scripts have execute permissions using
chmod +x filecommand, then you can execute:i.e. without prefixing with actual path of these scripts.