FP Survivor - Replacement CD on the way.
Bob Stockler
bob at trebor.iglou.com
Mon Aug 15 12:51:15 PDT 2005
John Esak wrote (on Mon, Aug 15, 2005 at 01:57:32PM -0400):
| As for the . thing. Essentially, the . means to "exec" the script I'm
| calling. That means run it in a brand new shell, don't run it as a subshell
| and return to the calling shell. So I do things like this all the time.
On the contrary, the "dot" command causes the lines in the
file named as an argument to it to be read and executed in
the current shell. (BTW, that file doesn't have to be
executable, just readable by the user.)
| The shell script might read:
|
| cd /u/appl/filepro
| echo "You are now sitting in /u/appl/filepro..."
|
| If the script is called "fp", I just do:
|
| . fp
|
| at the prompt and I'm cd'd to the directory and it tells me I'm there. (I
| work as filepro a lot to be able to do this... by the way...)
|
| Or I set some environment variables like:
|
| PFTERM=ansic; export PFTERM
|
| and then if the script is called "ansi", I do:
|
| . ansi
|
| which runs my termcap for filePro to ansi.
|
| I have a reversing script called "ansi-nc" which does not have the PV
| variable I describe in the tutorial in it. By doing:
|
| . ansi-nc
|
| I am put into the mode I like which doesn't have ansi colors.
|
| The . is very useful in this regard. Think of it this way. If the script
| says...
|
| cd /u/appl/filepro
| echo "You are sitting in /u/appl/filepro..."
|
| and you just execute that script by itself (without the dot). It would run
| out in a subshell, cd you to /u/appl/filepro, tell you it did it... and then
| immediately dump you back to the calling shell.... which leaves you wherever
| you were sitting and with the same environment you had before you executed
| the command. It's much like running "dclerk" from a shell prompt. It runs
| out and brings up dclerk, which you use until you are done. When you exit
| dclerk, you are right back where you started from.
|
| Incidentally, if you were to use the . inside a shell script... it has a
| completely different aspect. It is called "sourcing" and you might do
| something like this:
|
| TERM=ansi
| LPDEST=mary
| PFSCC=ON
| export TERM LPDEST PFSCC
| . otherfile
|
| And in "otherfile" would be 50 more environment variable assignments (and
| their associated export). The file sources that "otherfile" for this
| information and includes it in the current script as if you had typed it all
| in to this script like the first 3 variables.
Some call it "sourcing" when used in one's current shell as
well, and its behavior then is just the same as its behavior
in the shell script.
Bob
--
Bob Stockler -+-+- bob at trebor.iglou.com -+-+- http://members.iglou.com/trebor
Author: MENU EDIT II - The BEST Creator/Editor/Manager for filePro User Menus.
Fully functional (time-limited) demos available by email request (specify OS).
More information about the Filepro-list
mailing list