Wednesday, July 06, 2005

filename expansion after parameter expansion

This point came up during an intersting post on bug-bash.I just ran a few commands to check this out.

If nullgob is set then bash will not echo the pattern if it fails the filename expansion.

$echo abc*
abc*
$shopt -s nullglob
$echo abc*

$

So now if you have a variable like

$test=p*
$echo $test
purchase
$echo "$test"
*



Moral of the story:Quoting (double) a variable suppresses filename expansion.

0 Comments:

Post a Comment

<< Home