From: Eric Hodel Date: 2003-10-02T22:19:16-07:00 Subject: Re: backquotes, system, shell and ruby --cjNiBkmi8s9yAE0W Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable John Carter (john.carter@tait.co.nz) wrote: > Consider backquotes. >=20 > a =3D `wc *.c` >=20 > What did that do? Same as open("|wc *.c"). >=20 > It ran bash! >=20 > Yuck! >=20 > system( "tar -xvzf foo.tgz foo") >=20 > What did that do? It ran shell! >=20 > Why? Why does a scripting language like Ruby keep invoking an old and bad > scripting language call shell? Because that's what system(3) does, check the man page. Perl does it, and if I had a Python installed, I bet python would do it too. If you want it to not run in a shell, use fork and exec. --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --cjNiBkmi8s9yAE0W Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE/fQbUMypVHHlsnwQRAqWjAJ9DyyL833lzbfM4pesnCuZpNoItdQCg+idf II0y/k9ARU3ny7SoapRpXDQ= =MYvX -----END PGP SIGNATURE----- --cjNiBkmi8s9yAE0W--