Re: PDF (subsittucion de comandos en bash)
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
Reply to:
- References:
- Re: PDF
- From: David Charro Ripa <dcharro@iname.com>
- Re: PDF
- From: Hue-Bond <hue@cyberchat2000.com>