hi,
I’m trying to run a piped Linux command by creating the script zypper_script.sh in /tmp folder. The command i’m using is
zypper search -s kernel | grep -P ‘(^|\s)\Kkernel-default-devel(?=\s|)’ | grep (rpm -qa | grep kernel-default-[0-9] | sort -Vr | head -1 | cut -c 16- | awk ‘{print substr($0, 1, length($0)-7)}’) > /tmp/package-info
This will give info regarding the package available in the file /tmp/package-info.
But while executing the script using the execute resource, i’m getting the below error.
Error executing action run on resource ‘execute[Check if package is available]’
Mixlib::ShellOut::ShellCommandFailed
Expected process to exit with [0], but received ‘1’
---- Begin output of sh /tmp/zypper_script.sh ----
STDOUT:
STDERR:
---- End output of sh /tmp/zypper_script.sh ----
Ran sh /tmp/zypper_script.sh returned 1
Resource Declaration:
execute “Check if package is available” do
command "sh /tmp/zypper_script.sh"
end
Kindly help me ASAP to resolve the issue. Thanks