in my script an if statement returns:
line 3: []: command not found
the statement:
if ["$(pidof -x $(basename $0) -o %PPID)"]; then
echo process already running; exit;
fi
what I tried:
if [["$(pidof -x $(basename $0) -o %PPID)"]]; then
echo process already running; exit;
fi
if [["$(pidof -x basename $0 -o %PPID)"]]; then
echo process already running; exit;
fi
if ["$(pidof -x basename $0 -o %PPID)"]; then
echo process already running; exit;
fi
if [[$(pidof -x basename $0 -o %PPID)]]; then
echo process already running; exit;
fi
none seems to work.I get similar error.
line 3: [[]]: command not found
I got the code from here: https://linuxpip.org/rclone-examples/ https://forum.rclone.org/t/continuous-syncing/12377/2
I did research here: https://wiki.bash-hackers.org/syntax/ccmd/conditional_expression and looked at the man bash’s Compound Commands section but they don’t seem to help.
please help Thank you!
[
and[[
and before]
and]]
. – cas Oct 18 '21 at 05:36