Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Start file sharing from the terminal UNIX
This may be useful for some people. To start file sharing from the terminal do the following:
cd /usr/sbin
./AppleFileServer
    •    
  • Currently 3.67 / 5
  You rated: 4 / 5 (3 votes cast)
 
[8,479 views]  

Start file sharing from the terminal | 2 comments | Create New Account
Click here to return to the 'Start file sharing from the terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
a couple shell things
Authored by: bakednotfried on May 11, '01 08:22:35PM
hey folks, i thought i'd take this opportunity to expand on this example and hopefully teach some of y'all some new shell tricks. colin lets us know that we can start filesharing with these two commands.
cd /usr/sbin
./applefileserver
this does two things. first, we change our working directory to /usr/sbin. then, we tell the shell to run the file applefileserver in our current directory. the character "." is how the shell refers to the current directory. "." is pronounced "dot". so, the second line of colin's example would be pronounced "dot slash applefileserver".

it's true :)

anyway, unix has the notion of a PATH. your PATH is the list of directories the shell will look in when you give it the name of an application to run. you can see your path by running

echo $PATH
your PATH is displayed as a colon separated list of directories. you can see other environment variables with the
env
command.

/usr/sbin is not normally in a users PATH, so if we just typed

applefileserver
the shell wouldn't find it. to get around this, colin just changed to the /usr/sbin directory and told the shell to run the file applefileserver in the current directory.

there are atleast two other solutions.

you can always just tell your shell the absolute path to the application, as in

/usr/sbin/applefileserver
or you can add /usr/sbin to your PATH. in bash,
export PATH=$PATH:/usr/sbin
this tells your shell to add the directory /usr/sbin to the current value of $PATH. note, that this is only true until you logout from your shell. you can create a file to tell your shell to do this everytime you login. in bash, edit or create a file in your home directory called .bash_profile and add the line
export PATH=$PATH:/usr/sbin
to the file. then, everytime you login, /usr/sbin will be in your PATH.

anyone else know how to do it for other shells?

mike

[ Reply to This | # ]

a couple shell things
Authored by: Bart VdBroeck on May 14, '01 05:51:20PM

>anyone else know how to do it for other shells?

Sure, someone does. And one of those is even kind enough to let you all know about it. ;-P OK, enough joking around.

You showed it entirely right. Some people create an entirely new list of paths once they learn about the path variable, but expanding the existing one is the way to go.

In csh (or the derived tcsh, the default shell in Mac OS X) you can do it in two ways:

setenv PATH "${PATH}:/Software/BSD/bin"
or
set path = (somepath $path)

In the last entry I've changed the sequence around. This might have advantages and disadvantages. An advantage is that when two commands have the same name, the one in the added directory (e.g. one of your own directories) gets executed instead of the standard one. A disadvantage is that when two commands have the same name, the one in the added directory gets executed instead of the standard one. You see, the new version might have fenomenal new functionalities you desperately need, or it may be a version with an intended flaw or a trojan horse or something. <end of computer filosophical musing>

I don't know how to do it for the Korn shell or others. Anyone? ...

Bart



[ Reply to This | # ]