I have the following shell script :
#!/bin/sh
output=`./process_test.sh status_pid | grep "NOT STARTED: process_1" --line-buffered`
if[[ -z ${output} ]]
then
echo "process is not running"
else
echo "process is running"
fi
where ./process_test.sh status_pid is my utility for finding whether a process is running or not .e.g. if process_1 is not running it will give: NOT STARTED: process_1. Further
this utility is perfect and does not have any issue. I suspect the issue is with if syntax
on running this script I get the following output:
./test.sh: line 18: if[[ -z NOT: command not found
./test.sh: line 19: syntax error near unexpected token `then'
./test.sh: line 19: `then'
Can you help to resolve this issue?
You must use spaces to separate keywords such as
iffrom the arguments or commands such as[[.