Twitter Updates

Tuesday, 16 September 2008

Bash Double Quotes Single Quotes

When working on the command line some scripts/programmers seem to arbitrarily switch between "Double Quotes" and 'Single Quotes'.

The difference in bash at least is
Double quotes evaluate variables inside of them.
Single quotes are a literal string (NO evaluation).

computer ~ $ fred=result
computer ~ $ echo "fred is $fred"
fred is result
computer ~ $ echo 'fred is $fred'
fred is $fred

No comments: