Re: PDF (subsittucion de comandos en bash)

2000-07-03 Por tema Jaime E. Villate
Hue-Bond wrote:
 El viernes 30 de junio de 2000 a la(s) 20:48:29 +, 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



Re: PDF (subsittucion de comandos en bash)

2000-07-03 Por tema Hue-Bond
El lunes 03 de julio de 2000 a la(s) 09:43:52 +0100, Jaime E. Villate contaba:

Pués según el manual de bash, las comillas graves es el método antiguo y
$() es el método nuevo.

 Lo serán para bash, pero ¿y si usas otro shell?


-- 
 Just do it.

David Serrano [EMAIL PROTECTED]Linux 2.2.15 - Reg. User #87069
Hi! I'm a .signature virus!  Copy me into your ~/.signature to help me spread!


pgpgGWIm6YTZx.pgp
Description: PGP signature


Re: PDF (subsittucion de comandos en bash)

2000-07-03 Por tema Jaime E. Villate
Hue-Bond wrote:
 El lunes 03 de julio de 2000 a la(s) 09:43:52 +0100, Jaime E. Villate contaba:
 Pués según el manual de bash, las comillas graves es el método antiguo y
 $() es el método nuevo.
  Lo serán para bash, pero ¿y si usas otro shell?

ah, a eso te referías con mas portable. entonces estoy de acuerdo
contigo.
Saludos,
Jaime