I want to write script that accepts process name (I ask the user for process name each time followed by a prompt on the same line) if process exists it will print "EXISTS" or if it doesn't then "DOES NOT EXIST" depending on whether such a process is currently on the system.
Example:
Enter the name of process: bash
exists
Enter the name of process: bluesky
does not exist
My code:
#!/bin/bash
while true
do
read -p "Enter the name of process: "
if [ pidof -x > 0 ]; then
echo "exists"
else
echo "does not exist"
fi
done
The error message I receive.
pidof: unary operator expected