Link doesn't work for /usr/local/bin

Hi there,

I'm trying to get a program to work that as soon as I fire up terminal, I can just type "program" for example and have it open in the terminal.  For some reason i'm having a heck of a time.  The program that I'm trying to install requires a .ini file (Or so I'm guess, i could be completely wrong).  Anyways, here is the command that I tried:

sudo ln -s /Users/myuser/documents/program /usr/local/bin/program

and then to make it executable:

sudo chmod a+x /usr/local/bin/program

Now when I type "program" (Without the quotation marks ofcourse) in terminal, I get:

fopen: program.ini: No such file or directory
LVL 5
bswinnertonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
what do you get when you type
/usr/local/bin/program
0
bswinnertonAuthor Commented:
fopen: /usr/local/bin/program.ini: No such file or directory
0
bswinnertonAuthor Commented:
However it does work inside of its natural folder (/Users/myuser/documents/program)
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

jgiordanoCommented:
you might want to try and add  /Users/myuser/documents to your path but it's looking for files that exist in the original directory.

where does program.ini exist?
0
AJViennaCommented:
you might wanna try to use alias instead (that way you do not require a link):
alias program="/Users/myuser/documents/program"
0
AJViennaCommented:
PS: If that works you have to add it to your ~/.bashrc to make it permanent.
0
bswinnertonAuthor Commented:
I tried the alias, and then chmod a+x, but now when I hit enter in terminal, it doesn't launch it, it just goes to the next line.

and @jgiordano, I don't know where program.ini is. I checked the terminal program directory i'm trying to run and its not anywhere in there. (But again it works if i run it from the normal directory).  What do you mean by adding /Users/myuser/documents to your path?  Like CD first? That would defeat the purpose of having it in /usr/local/bin.
0
jgiordanoCommented:
no, in your .bashrc  in your home directory add

google PATH for linux so you understand a little of how it works but it would be something like below.

export PATH=$PATH:/Users/myuser/documents
0
AJViennaCommented:
you could also write a small script

#!/bin/sh
cd /Users/myuser/documents/program
program

Put the script to /usr/local/bin/program
and chmod u+x it.

The program changes the path, but just for the program itself. The current directory remains the same.
0
bswinnertonAuthor Commented:
Hmm, I don't see why my computer is being so difficult! =P

I tried the script idea and now when I try it I get:

/usr/local/bin/program: fork: Resource temporarily unavailable
0
bswinnertonAuthor Commented:
But once again, if I go like this:

/Users/myuser/Documents/program

It works..
0
bswinnertonAuthor Commented:
Okay, Today I CD'd into a directory and it worked! I'm not sure which step it was, but thank you!!
0
bswinnertonAuthor Commented:
I'm sorry, please disregard that last post.  That was meant for a different topic XD
0
TintinCommented:
Is 'program' a binary or script?  If it's a script, could you please post the contents.
0
bswinnertonAuthor Commented:
The program is "John the ripper" Used specifically for testing my own passwords in my own environment.
0
AJViennaCommented:
Does the line:
open /Users/myuser/documents/program
work, either directly or in the script?
0
bswinnertonAuthor Commented:
Yes, that opens it up in a new terminal and runs it.
0
bswinnertonAuthor Commented:
Actually, maybe not.  The program is designed so that you would type "program" and then "file" so that you would have the program work on a certain file.  If you type open program file it just opens both of them, instead of having program work on the file.
0
AJViennaCommented:
Oh, that was important information. That is probably the reason why the script solution did not work.
Then try this alternative script:


#!/bin/sh
cd /Users/myuser/documents/program
program $@

Open in new window

0
bswinnertonAuthor Commented:
I get:  line 3: program: command not found


0
AJViennaCommented:
It should of course cd correctly like below. Maybe you corrected that yourself, but the error message looks as if not. I assume you translated the name of your program to program?
#!/bin/sh
cd /Users/myuser/documents
program $@

Open in new window

0
AJViennaCommented:
What is the exact filename of your program?
0
bswinnertonAuthor Commented:
Yes, I correctly changed the filename.  It is actually called "john".  I think what the error was saying was that it doesn't know the command program.
0
AJViennaCommented:
a wait of course. The program is not in your path. Thus it has to be
./john
in the script.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Operating Systems

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.