I have a shell script that checks how many instances of an application that are open and I would like to check the length of it to decide what to do next, currently I'm doing:
CNT=`perl -e '@ret=qw($LIST); print scalar @ret;'`
if [ "$CNT" -le 2 ]; then
The problem is that the $CNT always = 1, it's pretty obvious that I'm not using the correct syntax to pass $LIST into the line of perl but I can't seem to find how to do it correctly. There's likely other ways of doing this than using perl but I'm more interested in how to do using perl than I am by using awk, python, or any of the numerous other options.
Thanks in advance.