About
Community
Bad Ideas
Drugs
Ego
Erotica
Fringe
Society
Technology
register | bbs | search | rss | faq | about
meet up | add to del.icio.us | digg it
Go Back   Community > Technology > Everything *NIX
Register FAQ Members List Calendar Today's Posts

Everything *NIX This is a general forum about all forms of *nix. Post your ideas and thoughts on this wonderful OS family. Talk about your personal favorite flavor of *nix and why you think it's so much better than the others. Anything pertaining to *nix and *nix administration should be posted here.

Reply
 
Thread Tools Display Modes
  #1   Add Punk_Rocker_22 to your ignore list  
Old 2008-11-30, 04:55
Punk_Rocker_22 Punk_Rocker_22 is offline
Regular
 
Default Registering commands

When I type
Code:
firefox
into terminal I want it to execute
Code:
/usr/bin/firefox/firefox
How do I register this command?
Reply With Quote
  #2   Add Prometheum to your ignore list  
Old 2008-11-30, 05:42
Prometheum Prometheum is offline
Regular
 
01 Send a message via AIM to Prometheum Send a message via MSN to Prometheum
Default Re: Registering commands

Add /usr/bin/firefox to your $PATH variable. When you type a program name into the shell, it searches the folders in that variable and stops when it hits the first one. Typically, it looks like this:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Possibly different. That's my Ubuntu system, this is my Gentoo system:

/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.1.2

This is my FreeBSD system:

/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/home/*****/bin

What you need to do is add a line like
Code:
export $PATH = "/usr/bin/firefox:$PATH"
in your .bashrc.
Reply With Quote
  #3   Add Punk_Rocker_22 to your ignore list  
Old 2008-11-30, 07:22
Punk_Rocker_22 Punk_Rocker_22 is offline
Regular
 
Default Re: Registering commands

I tried adding
Code:
export $PATH = "/usr/bin/firefox:$PATH"
and
Code:
PATH =$PATH/usr/bin/firefox
export PATH
to .bashrc, .bash_profile, and /etc/profile

no luck

When I tried
Code:
PATH =$PATH/usr/bin/firefox
in terminal it worked until I closed the window and reopened it
Reply With Quote
  #4   Add Prometheum to your ignore list  
Old 2008-11-30, 22:24
Prometheum Prometheum is offline
Regular
 
01 Send a message via AIM to Prometheum Send a message via MSN to Prometheum
Default Re: Registering commands

You'll need to close and open a new shell before it takes effect, or do
Code:
source ~/.bashrc
Reply With Quote
  #5   Add Fate to your ignore list  
Old 2008-12-02, 01:29
Fate Fate is offline
Moderator
 
Professional Bastard Send a message via ICQ to Fate Send a message via AIM to Fate Send a message via Yahoo to Fate
Default Re: Registering commands

A slightly more braindead but perhaps less annoying way to do it might be just to create a symlink to /usr/bin/firefox/firefox called "firefox." Just stick it somewhere that's in your collection of $PATH places, like /usr/bin. Done.

That way you don't have to keep track of whatever gack you've had to add to your path variable, especially if you find yourself executing many programs from nonstandard locations.

Back when I started messing with Linux I made a symlink to ls called "dir," for when my ingrained DOS reflexes got the better of me.
Reply With Quote
  #6   Add Punk_Rocker_22 to your ignore list  
Old 2008-12-02, 02:12
Punk_Rocker_22 Punk_Rocker_22 is offline
Regular
 
Default Re: Registering commands

Thank you Prometheum, I got it working. And Fate, that's a clever idea. I think I'll start doing that.
Reply With Quote
  #7   Add coroner to your ignore list  
Old 2008-12-02, 20:05
coroner coroner is offline
Moderator
 
Sierra Vista. Arizona
Default Re: Registering commands

Actually instead of modifying your path for any particular purpose, like executing a single command, instead of having access to many binaries or shell scripts, you can set an alias.

Look at the alias manual page, it is part of /bin/bash:
Quote:
alias [-p] [name[=value] ...]
Alias with no arguments or with the -p option prints the list of
aliases in the form alias name=value on standard output. When
arguments are supplied, an alias is defined for each name whose
value is given. A trailing space in value causes the next word
to be checked for alias substitution when the alias is expanded.
For each name in the argument list for which no value is sup-
plied, the name and value of the alias is printed. Alias
returns true unless a name is given for which no alias has been
defined.
Reply With Quote
  #8   Add coroner to your ignore list  
Old 2008-12-02, 20:07
coroner coroner is offline
Moderator
 
Sierra Vista. Arizona
Default Re: Registering commands

Instead of modifying your path for any particular purpose like having access to a directory of binaries or shell scripts, you can set an alias for a single commmand.
Take a look at the manual page for alias, it is part of /bin/bash manual page:
Quote:
alias [-p] [name[=value] ...]
Alias with no arguments or with the -p option prints the list of
aliases in the form alias name=value on standard output. When
arguments are supplied, an alias is defined for each name whose
value is given. A trailing space in value causes the next word
to be checked for alias substitution when the alias is expanded.
For each name in the argument list for which no value is sup-
plied, the name and value of the alias is printed. Alias
returns true unless a name is given for which no alias has been
defined.
Reply With Quote
  #9   Add Prometheum to your ignore list  
Old 2008-12-02, 21:22
Prometheum Prometheum is offline
Regular
 
01 Send a message via AIM to Prometheum Send a message via MSN to Prometheum
Default Re: Registering commands

Quote:
Originally Posted by Fate View Post
A slightly more braindead but perhaps less annoying way to do it might be just to create a symlink to /usr/bin/firefox/firefox called "firefox." Just stick it somewhere that's in your collection of $PATH places, like /usr/bin. Done.

That way you don't have to keep track of whatever gack you've had to add to your path variable, especially if you find yourself executing many programs from nonstandard locations.

Back when I started messing with Linux I made a symlink to ls called "dir," for when my ingrained DOS reflexes got the better of me.
Note that if you do this, the standard place for site-local stuff is in /usr/local.
Reply With Quote
  #10   Add Fate to your ignore list  
Old 2008-12-02, 21:30
Fate Fate is offline
Moderator
 
Professional Bastard Send a message via ICQ to Fate Send a message via AIM to Fate Send a message via Yahoo to Fate
Default Re: Registering commands

I thought it was /usr/local/bin? /usr/local isn't part of the default $PATH arrangement in Ubuntu, for instance, but /usr/local/bin is.

Go figure.
Reply With Quote
This thread continued for 2 pages in the real archive, 17 posts total - only page 1 survived here.
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
Forum Jump

 
To the best of our knowledge, the text on this page may be freely reproduced and distributed.
 

totse.com certificate signatures
 
 
About | Community | Bad Ideas | Drugs | Ego | Erotica | Fringe | Society | Technology
Hot Topics