LinuxQuestions.org
Review your favorite Linux distribution.
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 02-09-2006, 11:53 AM   #1
matrixon
Member
 
Registered: Feb 2005
Location: mexico city
Distribution: 2.6.17-gentoo-r8
Posts: 127

Rep: Reputation: 15
how to make a sh run as bin?


hi i have limewire and to run it i hace to change to the directory cd /home/user/limewire
and then run the shell script ./runlime.sh

i want to run limewire just by typing limewire on the terminal

how can i do this ?
 
Old 02-09-2006, 12:18 PM   #2
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 30
You need to know the concept of the PATH environment variable. When you give an unqualified command name, the system searches through all the directories in the PATH looking for an executable of this name, and launches the first one it finds. So adding the limewire directory to the path will let it find runlime.sh:
Code:
export PATH=$PATH:/home/user/limewire
However, there are several problems with this; firstly, the program's called runlime.sh and not limewire as you requested. Secondly, the script may well assume that the current directory is /home/user/limewire, and might not work from any others (I know that Eclipse and Azureus at least do this and wouldn't be surprised if it was true for other apps). Also, from a tidiness point of view it's nicer not to add a new directory to the path for every new app that starts like this.

What I would do, then, is create a small shell script to act as a wrapper. Something like:
Code:
#!/bin/sh
# Launch Limewire

cd /home/user/limewire
./runlime.sh
and save that file as 'limewire', make it executable and put *that* somewhere in the path. On most distributions, it's customary to put small personal executables in the folder ~/bin, and a lot of them will automatically add this directory to the path if there's something in it (Debian at least does). In any case, put this script somewhere in the path (move it to /usr/local/bin as root if you must) and then you will be able to launch limewire by just typing limewire.
 
Old 02-09-2006, 01:52 PM   #3
hand of fate
Member
 
Registered: Nov 2003
Distribution: Mandriva
Posts: 441

Rep: Reputation: 31
Creating the shell script is not necessary. All you really need to do it create a link called "limewire" from somewhere in the path to /home/user/limewirerunlime.sh.

BTW. if you did decide to write the script anyway (even though it's completely pointless exercise...), you don't need to change to the directory before you run the file, so just putting
Code:
/home/user/limewire/runlime.sh
would do the same thing as
Code:
cd /home/user/limewire
./runlime.sh
but would be a smaller file.
 
  


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
Help Please how can i run .bin files remon Linux - Newbie 3 12-09-2005 04:19 PM
I accidentally deleted make file in /usr/local/bin, now cannot use make command.... Niceman2005 Linux - Software 2 11-17-2004 08:55 PM
how to run .bin files JMK Linux - Newbie 5 02-20-2004 10:20 PM
How to run a .bin file? gschrade Linux - Newbie 3 11-11-2003 12:15 AM
can't run file .bin, please help lomaree Linux - Software 24 05-29-2003 06:26 PM


All times are GMT -5. The time now is 03:15 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