mercredi 7 janvier 2015

Variable expansion in Bash


I tried the following commands



variable='one|name'
echo $variable


The output is



one|name


whereas echo one|name gives an error No command 'name' found. This is reasonable because bash treats | as a pipe and tries to execute command name with one as input.


But why does echo $variable print one|name? After Parameter and Variable expansion, shouldn't it be equivalent to echo one|name?


Version:



GNU bash, version 4.3.11(1)-release (i686-pc-linux-gnu)


Aucun commentaire:

Enregistrer un commentaire