Reputation: 2650
I have a custom command called git-feature, which is located in a Unix executable file with the same name. I'm trying to configure the $PATH variable in ~/.bash_profile
so that it recognizes the Unix file. I updated the PATH variable to include the file's path:
export PATH=$PATH:~/Applications/MAMP/htdocs/code/git-shortcuts/
The echo $PATH
command in my bash terminal produces the following result:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/myname/Applications/MAMP/htdocs/code/git-shortcuts/
But trying to call git-feature
leads to the following error:
-bash: git-feature: command not found
There are a few similar questions on S.O., but none of the ones I found solved this specific type of issue. Do I need to change the PATH variable differently in order for my custom command to be recognized by bash?
Upvotes: 1
Views: 1234
Reputation: 9877
You are modifying the PATH variable correctly.
Make sure that git-feature
really is in that directory, that it has the executable bit (+x) set, and that the directories leading to it give you rights to execute it:
MYFILE=/Users/myname/Applications/MAMP/htdocs/code/git-shortcuts/git-feature
ls -l "$MYFILE"
chmod +x "$MYFILE"
[ -x "$MYFILE" ] && echo "File can't be executed, check directory rights"
Upvotes: 1