Solved

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

Posted on 2008-10-20
24
470 Views
Last Modified: 2013-11-14
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
0
Comment
Question by:bswinnerton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 8
  • 2
  • +2
24 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 22761037
what do you get when you type
/usr/local/bin/program
0
 
LVL 5

Author Comment

by:bswinnerton
ID: 22761086
fopen: /usr/local/bin/program.ini: No such file or directory
0
 
LVL 5

Author Comment

by:bswinnerton
ID: 22761091
However it does work inside of its natural folder (/Users/myuser/documents/program)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:jgiordano
ID: 22761120
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
 
LVL 5

Expert Comment

by:AJVienna
ID: 22761195
you might wanna try to use alias instead (that way you do not require a link):
alias program="/Users/myuser/documents/program"
0
 
LVL 5

Expert Comment

by:AJVienna
ID: 22761204
PS: If that works you have to add it to your ~/.bashrc to make it permanent.
0
 
LVL 5

Author Comment

by:bswinnerton
ID: 22761414
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
 
LVL 11

Expert Comment

by:jgiordano
ID: 22761531
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
 
LVL 5

Expert Comment

by:AJVienna
ID: 22761787
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
 
LVL 5

Author Comment

by:bswinnerton
ID: 22763004
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
 
LVL 5

Author Comment

by:bswinnerton
ID: 22763022
But once again, if I go like this:

/Users/myuser/Documents/program

It works..
0
 
LVL 5

Author Comment

by:bswinnerton
ID: 22763306
Okay, Today I CD'd into a directory and it worked! I'm not sure which step it was, but thank you!!
0
 
LVL 5

Author Comment

by:bswinnerton
ID: 22763315
I'm sorry, please disregard that last post.  That was meant for a different topic XD
0
 
LVL 48

Expert Comment

by:Tintin
ID: 22763661
Is 'program' a binary or script?  If it's a script, could you please post the contents.
0
 
LVL 5

Author Comment

by:bswinnerton
ID: 22763691
The program is "John the ripper" Used specifically for testing my own passwords in my own environment.
0
 
LVL 5

Expert Comment

by:AJVienna
ID: 22769351
Does the line:
open /Users/myuser/documents/program
work, either directly or in the script?
0
 
LVL 5

Author Comment

by:bswinnerton
ID: 22770594
Yes, that opens it up in a new terminal and runs it.
0
 
LVL 5

Author Comment

by:bswinnerton
ID: 22770611
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
 
LVL 5

Expert Comment

by:AJVienna
ID: 22778507
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
 
LVL 5

Author Comment

by:bswinnerton
ID: 22778648
I get:  line 3: program: command not found


0
 
LVL 5

Expert Comment

by:AJVienna
ID: 22778836
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
 
LVL 5

Expert Comment

by:AJVienna
ID: 22778843
What is the exact filename of your program?
0
 
LVL 5

Author Comment

by:bswinnerton
ID: 22781015
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
 
LVL 5

Accepted Solution

by:
AJVienna earned 500 total points
ID: 22783488
a wait of course. The program is not in your path. Thus it has to be
./john
in the script.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question