Executing own Unix command in terminal?
Question
I made an Unix command, macmac2unix, which converts Mac's Word file for Unix platforms.
I would like to run the command as
$macmac2unix file1 file2 file3 ...
Problem: How can I run this command in every path?
I added the following to .bashrc unsuccessfully
CDPATH=:/Users/Sam/Documents/Unix
Solution
Try adding
export PATH=$PATH:/Users/Sam/Documents/Unix
to your .bashrc
Make your script executeable be sure it's located in /Users/Sam/Documents/Unix. You could reread your .bashrc with:
~> . ~/.bashrc
But if you already played around with your enviroment variables a restart of your terminal would be cleaner.
OTHER TIPS
Add it to PATH, not CDPATH.
Try adding it in PATH like this:
PATH=/Users/Sam/Documents/Unix:$PATH
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow