[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: SOLVED: How to use apostrophe in bash shell script?



Kent West <westk@acu.edu> [2002-09-30 20:51:17 -0500]:
> Thanks to Nate's help, I found the problem. I had another line above
> this one with a similar echo'd line that had an
> apostrophe. Apparently bash was interpreting everything between the
> two apostrophe's as a string, which explains some other odd
> behaviour I was seeing, but had put on the back burner to deal with
> this easier problem first.

Both "string" and 'string' delimit strings.  But there is a small
difference.  Double quotes expands variables while single-quotes do
not.

  echo "$$"
  24660
  echo '$$'
  $$

BTW $$ is the shell's process id number.  I could have used any
variable such as $RANDOM or but $$ seemed easy for a self-contained
example.  Also, `command` $(command) are also expanded in "string" but
not in 'string'.

Bob

Attachment: pgpL4cWADfIvB.pgp
Description: PGP signature


Reply to: