in reply to Running blocks of shell script from within perl script
If you want the hashbang to be respected, you need to write your code to a file, make the file executable and then run it.
Most likely, it will be far easier to just launch the file specified in the hashbang and pass it the command(s) on the command line, most likely with the -c switch:
my $shell= '/usr/bin/ksh93'; my $command= <<SHELL; typeset -A SIZE_MIN SIZE_MIN=([/var]=2097152 [/tmp]=1048576 [/home]=1048576) ISHACMP=$(lslpp -Lqc cluster.*.server.rte 2>/dev/null | grep -c cluste +r) for fs in ${!SIZE_MIN[*]}; do fssize=$(df -k $fs | grep -v Filesystem | awk \'{print $2}\') if (( $fssize < ${SIZE_MIN[$fs]} )); then print "BAD;$fs is less than minimum size ($SIZE_MIN[$fs]}), in +crease to minimum size" elif (( $fssize == ${SIZE_MIN[$fs]} )); then print "GOOD;$fs is at minimum size (${SIZE_MIN[$fs]} kb)" else print "GOOD;$fs is greater ($fssize) than minimum (${SIZE_MIN[ +$fs]})" fi done SHELL my @results= qx($shell -c '$command');
|
|---|