Hue-Bond wrote:
> El viernes 30 de junio de 2000 a la(s) 20:48:29 +0000, David Charro Ripa 
> contaba:
> >> TEMP = `tempfile`
> >�No tendria que ser la 1� linea asi?
> >TEMP=$(tempfile)

>    F�jate que las comillas son  inversas (graves). Es m�s portable
>    hacelo con comillas inversas que con la sintaxis $().
Pu�s seg�n el manual de bash, las comillas graves es el m�todo antiguo y
$() es el m�todo nuevo. Tambi�n hay una peque�a diferencia entre los
dos: $(comando) le pasa los caracteres \ al comando, mientras que
`comando` interpreta un \ como caracter de escape:

   Command Substitution
       Command substitution allows the output  of  a  command  to
       replace the command name.  There are two forms:

              $(command)
       or
              `command`

       Bash  performs  the  expansion  by  executing  command and
       replacing the command substitution with the standard  out�
       put  of  the  command, with any trailing newlines deleted.
       Embedded newlines are not deleted, but they may be removed
       during  word  splitting.   The  command substitution $(cat
       file) can be replaced by the  equivalent  but  faster  $(<
       file).

       When the old-style backquote form of substitution is used,
       backslash retains its literal meaning except when followed
       by  $,  `,  or  \.   The first backquote not preceded by a
       backslash terminates the command substitution.  When using
       the  $(command) form, all characters between the parenthe�
       ses make up the command; none are treated specially.

Tambi�n me parece mas f�cil de recordar $(comando) por ser mas parecido 
a $variable 


Jaime

Responder a