l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2003 Jan 09 08:56

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] bash question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] bash question

> Date: Wed, 08 Jan 2003 12:13:54 -0800
> From: Matt Holland <mdholland@ucdavis.edu>
> To: vox-tech@lists.lugod.org
> Subject: Re: [vox-tech] bash question
> Reply-To: vox-tech@lists.lugod.org
> Sorry, the example isn't quite clear... the only reason for the line 
> containing only '"$1";' was to demonstrate that the program that's 
> getting called by the script is in the path, and that the program runs. 
>   The line before that is also quite stripped down from what I would use 
> in the case I'm actually interested in:
> "$1 -i$I -$2 -$3 -$4 -o$3/$J.out > /dev/null";
> But it contained the elements that I wanted to test.  Anyway, thanks, 
> because the problem seems to have been the quotes.  I thought I needed 
> the quotes to force substitution of $1, $2, etc., but it seems I was wrong.

The shells have three kinds of quotes. Double quotes " " will supress
filename substitution for the * and ?  characters, and whatever is
between the quotes (including spaces) will be treated as a single token.
Single quotes (apostrophes) ' ' will supress filename substitutions and
variable substitutions and command substitutions (but for some reason in
tcsh it doesn't supress history substitutions), and whatever is between
the quotes (including spaces) will be treated as a single token.
Backquotes ` ` are equivalent in bash to $( ), and anything between them
is regarded as a command to be run, and whatever that command writes to 
standard output is substituted (as multiple tokens, unless the whole 
construct is listed in quotes).

Try the following to give you a good example of what goes on:

mkdir test
cd test
touch *
touch "*"
thouch "$USER"
touch '$USER'
touch `date`
touch "`date`"
touch '`date`'

when you're done, use rm -i * to delete everything
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.