linux - Why does this shell script not run? -
i'm trying run script
echo "buscando instancias del servidor corriendo actualmente...." processid=$(ps -fea | grep jboss | grep -v grep | awk '{print $2}' | xargs) host=$(/sbin/ifconfig eth0 | grep -eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) echo "$processid" echo "$host" if [ -z "$processid"] echo "hay instancias corriendo del servidor con id proceso: $processid" else echo "no hay instancias del servidor corriendo actualmente" fi
but error:
syntax error near unexpected token
fi
try adding space before closing brackt in if statement so:
echo "buscando instancias del servidor corriendo actualmente...." processid=$(ps -fea | grep jboss | grep -v grep | awk '{print $2}' | xargs) host=$(/sbin/ifconfig eth0 | grep -eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) echo "$processid" echo "$host" if [ -z "$processid" ] echo "hay instancias corriendo del servidor con id proceso: $processid" else echo "no hay instancias del servidor corriendo actualmente" fi
Comments
Post a Comment