#!/usr/bin/perl -w use strict; # Enforce declarations my ( $cmd, $status ); print "Test1\n\n"; $cmd = "somprog var"; $status = system($cmd); if( $status != 0 ) { $! = $? >> 8; print "fail $!\n"; } print "\nTest2\n\n"; $cmd = "someprog \"var\""; $status = system($cmd); if( $status != 0 ) { $! = $? >> 8; print "fail $!\n"; } print "\nTest3\n\n"; $cmd = "ls t.t"; $status = system($cmd); if( $status != 0 ) { $! = $? >> 8; print "fail $!\n"; } exit; #### Test1 Can't exec "somprog": No such file or directory at ./err_cvt.pl line 10. fail Unknown error Test2 sh: someprog: not found fail Not owner Test3 t.t: No such file or directory fail No such file or directory