To make Perl shut up critically, but do nothing good, just change the code to:
open(my $PIPE_FROM_FREESPCHK, "-|", $cmdline) || zdie($MSG_PASSTHRU, "Error checking free space of file system.");
Please note, however, that this is absolutely not better in any way from the much more obvious:
open(my $PIPE_FROM_FREESPCHK, "$cmdline |") || zdie($MSG_PASSTHRU, "Error checking free space of file system.");
Because you do not share your tokens for calling exec directly. It would look like this:
open(my $PIPE_FROM_FREESPCHK, "-|", $cmd_name, @cmd_args) || zdie($MSG_PASSTHRU, "Error checking free space of file system.");
The question is whether you are running a shell command or just doing something. If your free check is something like df . 2>/dev/null | awk .... df . 2>/dev/null | awk .... df . 2>/dev/null | awk .... you need a complete shell. If it is just df , then you do not.
source share