LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   what the command [source] does ? (https://www.linuxquestions.org/questions/linux-newbie-8/what-the-command-%5Bsource%5D-does-197984/)

hq4ever 06-26-2004 12:23 PM

what the command [source] does ?
 
it has nothing to do with "compile from source", right?
i tried to man, info for it but that didn't told me anything.

what [source ... ] does & how / when should i use it ?

thank you.

LinuxLala 06-26-2004 03:03 PM

First of all, you need to phrase your questions well. That would help you fetch better answers.

Now, if you do
man source

You will find the manual page of source. The man pages are your best friend. Scroll down a little and you find the description of source
#source filename [arguments]
Read and execute commands from filename in the current shell
environment and return the exit status of the last command exe-
cuted from filename.

hq4ever 06-26-2004 03:33 PM

thanks,

LinuxLala, how would you prefer i asked the question?
if it wasn't clear enough from the title then sorry i tried to do this as informative as possible.


now about [man source], believe me i did this, i also did [info source] & i searched linuxquestion for posts about the command (as you might guess posts with the word source are not hard to find in linux forum)
now look i'm copying (by hand) from my linux screen onto my xp machine because i do not know how to get a linux
shell from windows yet :).

Quote:

$ man source

BASH_BUILTINS(1)

NAME
bash, :, ., [, alias, bg, bind, break, builtin, cd, command, compgen,
complete, continue, declare, dirs, disown, echo, enable, eval, exec,
exit, export, fc, fg, getopts, hash, help, history, jobs, kill, let,
local, logout, popd, printf, pushd, pwd, read, readonly, return, set,
shift, shopt, source, suspend, test, times, trap, type, typeset,
ulimit, umask, unalias, unset, wait - bash built-in commands, see
bash(1)
SEE ALSO
bash(1), sh(1)
you see when i type [man source] i get a list of all the basic commands available to me from bash and nothing more, this is on mandrake 10.0.

btmiller 06-26-2004 04:05 PM

Source is a bash builtin command, and all those commands are grouped together into one man page. If you had scrolled down, you would have seen a description of what source does. As LinuxLala says, it executes a file in the current bash shell environment. It's mostly useful for configuring environment -- for instance, I might want to make a bunch of custom aliases, or tweak my PATH or whatever. I would put the commands to do so in my .bashrc file, but that only gets read when I login or start a new shell. If I want my new things to apply to the shell I'm working under now, I do source .bashrc and that runs the .bashrc and applies any new aliases or environment variable settings to my current terminal session.

BTW -- you should look into ssh as a way to get a terminal on your Linux machine from a separate Windows machine.

LinuxLala 06-26-2004 04:09 PM

If only you scroll down, using the down arrow key 'coz mouse scroll doesn't work, comes the description I gave.

http://man.he.net/?topic=source&section=all

This is some online man page for source. Don't know how old this is :)

About me saying you didn't frame your question right, I mean't
Quote:

what [source ... ] does & how / when should i use it ?
I didn't understand the / part.

I understand how difficult it can be to search at LQ :) BTW, what Linux distribution are you running?

[EDIT}: The perils of keeping tabs open for too long and not replying sooner, someone else posts sooner, the same thing :D

btmiller, you are right, Cheers.


All times are GMT -5. The time now is 02:55 AM.