in reply to Re^2: gzip command always returns -1
in thread gzip command always returns -1
I get this output:#!/usr/bin/perl -w use strict; my $raw_ret; print "'true':\n"; `true`; $raw_ret = $?; printf("0x%08X\n", $raw_ret); print $raw_ret; print "\n"; print $raw_ret >> 8; print "\n"; print (($raw_ret >> 8) & 0xFF); print "\n"; print "\n"; print "'false':\n"; `false`; $raw_ret = $?; printf("0x%08X\n", $raw_ret); print $raw_ret; print "\n"; print $raw_ret >> 8; print "\n"; print (($raw_ret >> 8) & 0xFF); print "\n"; print "\n"; print "'nosuchprogramname':\n"; `nosuchprogramname`; $raw_ret = $?; printf("0x%08X\n", $raw_ret); print $raw_ret; print "\n"; print $raw_ret >> 8; print "\n"; print (($raw_ret >> 8) & 0xFF); print "\n"; print "\n";
I don't think your system can find "gzip" in it's search path. Either that or there is some other reason it can't execut "gzip". Try using the full path to the gzip program in your command. (To find the path use "which gzip" or "whereis gzip" or even "locate gzip" from a command line.)[frink@truth ~/code/perl]$./ret-code.pl 'true': 0x00000000 0 0 0 'false': 0x00000100 256 1 1 'nosuchprogramname': Can't exec "nosuchprogramname": No such file or directory at ./ret-cod +e.pl line 26. 0xFFFFFFFF -1 16777215 255
|
|---|