I am trying to execute a command with multiple parameters in a bash script:
#!/bin/bash
read a[{1..3}] <<< $(echo /opt/CPshrd-R77/bin/cpview history off); echo "${a[1]} ${a[2]} ${a[3]}"
#"/opt/CPshrd-R77/bin/cpview history off"
for (( i =0 ; i < ${#a[@]} ; i++ ))
do
printf "\n Running '$(a[$1]}' \n\n"
eval "${a[$i]}"
done
I hacked together this script from a couple examples on stackoverflow. What is happening is the cpview utility is being called instead of the full command terminating the history. Cpview is a Check Point utility used to display CPU, Memory, network stats, firewall performance, etc. Its buggy and it has a memory leak, so I need to shut it off.