LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-14-2006, 11:28 PM   #1
amanjsingh
Member
 
Registered: Mar 2004
Location: New York, USA
Distribution: Debian, Ubuntu
Posts: 71

Rep: Reputation: 15
To start a program from any directory


I want to run a program shoutcast from any directory that i am currently on. It is not necessary that the program should reside in the same directory. I just want to install it and then whenever I want by just typing ./sc_ver command. Not necessarily being in that directory.

Is there a global variable file in which if I put an entry will work?

Thanks
AJ
 
Old 12-14-2006, 11:39 PM   #2
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
What you need to do is put the program "sc_ver" in /usr/bin. You will need to be root. You can either copy it, or (better) create a symbolic link. To create symbolic link:
Code:
ln -s /path/to/shoutcast/sc_ver /usr/bin
Where /path/to/shoutcast is the path to wherever sc_ver is.

If you do this, then you start the program like any other - no ./ needed. The ./ just means the current directory - ie ./sc_ver means execute the sc_ver that is in the current directory.

I hope this helps
--Ian
 
Old 12-14-2006, 11:41 PM   #3
amanjsingh
Member
 
Registered: Mar 2004
Location: New York, USA
Distribution: Debian, Ubuntu
Posts: 71

Original Poster
Rep: Reputation: 15
Thanks. I will try and let you know. but thanks a lot, that was quite clear.
 
Old 12-14-2006, 11:43 PM   #4
bitva
Member
 
Registered: Dec 2002
Location: Los Angeles
Distribution: Debian
Posts: 72

Rep: Reputation: 15
There is an environment variable called PATH which contains directorys to look into when you want to execute something.

Run: echo $PATH

It should return something like:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11

You can either place the shoutcast executable in one of those directories and then logout and login again or you can create your own directory and add that directory to the PATH environment variable. The variable is usualy set when you login and during your login .bashrc or .profile in your home directory (sometimes not though) is sourced and the PATH environment is set either in there or by again sourcing /etc/profile. Take alook at those to files and see if you see a line that looks like:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11"

and add your new directory with the executable in it to it (seperate by semicolon). Logout and back in again and you should be good to go.

When executing shoutcast though, you won't need/want to type ./ before it. ./ means current directory.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I automatically start a program at start up? victordh Linux - General 7 10-27-2013 06:02 AM
program running from one directory, but not another DA WEED WIZARD Linux - Newbie 2 03-29-2006 01:03 PM
Program directory help... JustinCoyan Slackware 3 04-19-2005 10:27 AM
Program Directory nodnarb Linux - Software 2 07-18-2004 09:18 PM
Directory travesal program serotonincy Programming 3 02-22-2004 12:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration