Bug or unwanted behaviour in echo ?

Jelte Jansen jelte at NLnetLabs.nl
Thu Jan 8 05:15:34 PST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Damien Fleuriot wrote:
> 
> After swapping characters around I realized that echo just interprets
> $@ (which in our case is null).
> 

that's your shell doing the replacement, not echo.

With most most shells you can inhibit this behaviour by using single
quotes. Escaping the @ should work in some cases too.

$ echo "abc$@"
abc
$ echo 'abc$@'
abc$@

Jelte
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkll/G0ACgkQ4nZCKsdOncUSSQCeJuQZi1h+TrKNyxpHmu6hjykO
+mAAnjKGHk76zsyTwwaahKbFWHQvjf1E
=wJHv
-----END PGP SIGNATURE-----


More information about the freebsd-current mailing list