LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-09-2003, 09:47 AM   #1
boyblitz
LQ Newbie
 
Registered: Sep 2003
Location: Southend, UK
Distribution: Gentoo
Posts: 4

Rep: Reputation: 0
Question Making a program load from any dir


basically ive tried my best to search for this question on the forum but dont know the technical name so having no luck :S.

basically i want to be able to run my program from the console
"./server-bin"
without having to be in the programs dir
"/usr/local/games/armyops/System"

so i can just open the console and type in ./server-bin and it should run.

thanks.
 
Old 10-09-2003, 10:08 AM   #2
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,214

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
well you could put togeather a shell script such as this:
*cut here*
-------------
#!/bin/bash
/usr/local/games/armyops/System/server-bin
-------------
*end cut*
in one of the following directories
/bin
/usr/bin
/usr/local/bin
 
Old 10-09-2003, 10:10 AM   #3
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,214

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
or even better yet just type a command like this:
cp -l /usr/local/games/armyops/System/server-bin (/usr/bin, /usr/localbin, or /usr/bin)
to make a symbolic link to the program in one of the directories
programs or sym-links in those directories are executed as external commands regardless of the PWD
 
Old 10-09-2003, 10:14 AM   #4
Mirrorball
Member
 
Registered: May 2003
Location: Brazil
Distribution: Gentoo
Posts: 81

Rep: Reputation: 15
You could add the directory to your path.
Open your .bashrc file and add the following line:
Code:
export PATH=$PATH:/add/any/directory
Logout and login again and you should be able to execute the program by typing its name (without "./" because "./" refers to files in the current directory).
 
Old 10-09-2003, 10:38 AM   #5
boyblitz
LQ Newbie
 
Registered: Sep 2003
Location: Southend, UK
Distribution: Gentoo
Posts: 4

Original Poster
Rep: Reputation: 0
thanks guys
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Making Apache2 Load a different Default file! FearPasion710 Linux - General 3 12-16-2008 01:29 PM
program files dir equal zchoyt Linux - Newbie 2 08-31-2004 02:43 AM
Apache: making a dir with username and pwd fledermaus Linux - Networking 1 05-13-2004 09:40 AM
Calendar-making program?? PapaNoHair Linux - Software 1 05-09-2004 06:33 PM
load index.html when only ...com/dir is entered onlinesnet Linux - Networking 1 09-18-2001 09:40 PM


All times are GMT -5. The time now is 09:39 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration