views:

290

answers:

3

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
+3  A: 

Add it to PATH, not CDPATH.

Paul Tomblin
+5  A: 

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.

Node
No change. You can find my .bashrc here: http://dpaste.com/8008/
Masi
Hm, remove the line 5 and restart your terminal. Or try executing 'export PATH=$PATH:/Users/Sam/Documents/Unix' directly in your terminal for testing purposes.
Node
It seems to work. I get the following error: -bash: /Users/Sam/Documents/Unix/macmac2unix: Permission denied
Masi
I get the program work by running:$ chmod +x macmac2unix . Thank you!
Masi
+2  A: 

Try adding it in PATH like this:

PATH=/Users/Sam/Documents/Unix:$PATH
siddhadev