From: Josef 'Jupp' Schugt Date: 2005-04-04T04:56:03+09:00 Subject: Re: how to read output of shell command to variable? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Robert Klemme wrote: | | "Andrew Walrond" schrieb im Newsbeitrag | news:200504012358.52121.andrew@walrond.org... | |> On Friday 01 April 2005 23:52, sin kanti wrote: |>> In perl, we can do |>> |>> $output = `file filename.txt`; |>> |>> How can i do this in Ruby? |> |> $output = `file filename.txt` |> |> ;) | | In fact, you can even add the ";" and keep the Perl code altogether. | :-)) | | $output = `file filename.txt`; I'd prefer Perl's qx: $output = qx{file filename.txt} In Ruby that is output = x{file filename.txt} Note the absence of the dollar sign at the beginning of the variable name. The dollar has different meanings in Ruby and Perl. Josef 'Jupp' Schugt -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCUBldrhv7B2zGV08RAh8/AJ4xXeLsNXniiR/8bFbVnzo5ZIDcyQCgp0wQ Fv/VUex4eyIgthTEjvzdAf4= =moeo -----END PGP SIGNATURE-----