I evaluate whether certain variables match the expected values. Variables are set in memory by a specific program, the values of which can be accessed from the shell using a special program.
I pass the output of the awk shell command to get the specific field I want, and then I want to run it through perl to see if it matches the expected value. For instance,
ysgrp autostart | awk -F\: '{print $1}' | perl -e 'print {"True"} else {print "False"} if /on/'
However, I am getting complaints from perl about compilation errors next to "} else". How to handle if / then / else logic in single line perl?
source
share