viernes, 19 de junio de 2009

double/single quotes in bash

Single Quotes (' '): Preserve the literal value for each character within the quotes. For example,


$ string="Hello World"
$ echo $string
$ echo '$string "string"'
$ _


Double Quotes (" "): Preserve the literal value of all characters within the quotes. Rules Exception are: ‘$’, ‘`’ and‘\’ (shell expansion). For example,


string="Hello World"
echo $string
echo "My first script: $string, \"string\", "string""
$ _


Back Quotes or Back Sticks(``):Command Substitution (idem $() )
For example,


echo `date`, $(date)
$ _

No hay comentarios:

Publicar un comentario