Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 04-06-2005, 02:39 AM   #1
Registered: Dec 2004
Location: Washington State
Distribution: Slackware
Posts: 46

Rep: Reputation: 15
bash commands

I have a question reguarding executing files. Is it possible to execute a script from a different directory, making the script believe you are executing it from the directory it lives in?

For example, this is my situation:

I have Cube 3D on my box, but it is not a package or source to compile, it simply runs "as is" once extracted into a directory. The scripts obviously are written to use whatever path you're located at when you execute the main script. This gives me path errors when executing from a different directory, because the script is trying to find the necessary files in /whatever/directory/I'm/in/bin_unix/blah/blah instead of
/opt/cube/bin_unix, where it's all actually located.

Instead of editing all the scripts included with the game.. is there a way to make it appear as if the script was executed from it's root directory? (All of this, so that I may place a symlink to it in /usr/bin?)

Old 04-06-2005, 02:54 AM   #2
Senior Member
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
Yes, there's a way!
# cat >/usr/local/bin/ <<-"THEEND"
cd /opt/cube && ./cube
# chmod 755 /usr/local/bin/
Now just use /usr/local/bin/, which should be in your PATH. HTH.


Last edited by theYinYeti; 04-06-2005 at 02:55 AM.
Old 04-06-2005, 03:05 AM   #3
Registered: Dec 2004
Location: Washington State
Distribution: Slackware
Posts: 46

Original Poster
Rep: Reputation: 15
Awesome! Thanks. =)


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
bash commands Obie Linux - Security 4 08-15-2004 02:42 PM
Help with BASH Commands rridler Linux - Newbie 3 04-16-2004 04:43 PM
Bash commands PhuckFonix Linux - Newbie 2 03-30-2004 07:13 PM
ksh commands in bash nkelle Linux - General 2 11-13-2003 11:11 AM
Bash commands wprescott Linux - Distributions 6 04-27-2002 02:56 PM

All times are GMT -5. The time now is 09:02 PM.

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