>What exactly is the ' used for in the bash shell? Whenever it gets
typed
>at a bash prompt, I get:
To enter a string of characters that include spaces, so that the shell
does not treat a space as the beginning of a new argument.
The really cool thing about strings in Unix shells is that they can span
multiple lines. A carriage return
does not signify that the command is ready to be executed. All parens,
single quotes, double quotes, backticks, control structures must be
closed before the shells runs them.
myscript 'this is an arg'
or
myscript 'this is
an arg'
see one argument (accessible with $1), and
myscript this is an arg
sees four (accessible individually as $1 through $4 and collectively as
$*).
It all gets a bit hairier when you consider that the shell can do
environment variable substitution (interpolation) for you.
myscript "I live at $HOME"
sees $1 set to _I live at /home/landgren_, where /home/landgren is
indeed my home directory. (I use underscores here to delimit the string
merely to avoid ambiguity with quotes. They are not there in real life).
However,
myscript 'I live at $HOME'
sees $1 set to _I live at $HOME_.
DL
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.