I want to detect online network/shell services in my Solaris. I write following script for this purpose:
compare_ser()
{
if [ "$1" != "" ]; then
echo "True" >> Solaris.txt
fi
}
export -f compare_ser
svcs network/shell | cut -d ' ' -f1 | grep "online" | xargs -n1 bash -c 'compare_ser $@'
when i run svcs network/shell | cut -d ' ' -f1 | grep "online" | xargs -n1 echo
in terminal, I get the following output:
online
online
but my script don't show anything. What's its problem?