I have created a Bash script that simply does ls -l
.
In Mavericks and older versions of OSX I simply made a symlink to the script and put it in the /usr/bin
folder (ln -s ll.sh /usr/bin/ll
) and I could then execute the script using ll
from any folder.
Since upgrading to El Capitan I am unable to load this script. I have disabled SIP so that I am able to create the symlink and the script is definitely executable. The location (/usr/bin
) is definitely in the $PATH and I have even tried adding a path to the script into the $PATH too.
Nothing seems to work, all I am getting is -bash: ll: command not found
.
I have restarted the terminal after each update to the $PATH and I have tried source ~/.bash_profile
but neither are making any difference.
Edit: I also tried adding the current directory of the scripts to the $PATH and that was also giving the same error. In the end I have aliased all my scripts so that they will run.
ll.sh
-script_ is doing isls -l
then you should use an alias instead. Setalias ll='ls -l'
in the~/.profile
or~/.bash_profile
, whichever you're using. See 6.6 Aliases in the BASH Reference Manual.ls -l
as an example, I have quite a few scripts that do different things. I could make an alias for them all but I wondered if the previous implementation was still possible. If I run the .sh script it runs fine.ll.sh
simply needs to bell
. I have a separate directory I put all of my scripts in and add that directory pathname to the$PATH
. I have 150 scripts I've written in that directory and not one has an extension yet they're all executable. Some even have symlinks (not Finder Alaises, and not to be confused with bash aliases) to shorter names to type in the Terminal for convenience. This way all of my scripts are more centrally located and do not get mixed in with system executables.ls -l /usr/bin/ll
?