I am trying to find if a process is running or not, and if it is runing then I want to call a script or print something. I tried with the below few ways, but it gives me syntax error or command not found error.

```
APP_ID = ps -eaf | grep -i `whoami` | grep -i <process_name> | grep -i java | awk '{print$2}'

if[''!= '${APP_ID}'] then
    echo "Stopping instance $APP_ID"

```

I get the result as below:

```
test.sh: line 15: APP_ID: command not found
test.sh: line 17: if[!= ${APP_ID}]: command not found
Stopping instance 

```

What is wrong in the above script? And if it has some errors, then why does it print the `echo` in the `if` condition?

Also the below script fails saying `test.sh: line 3: [ps: command not found`

```
if [ps -eaf | grep -i `whoami` | grep -i <process_name> | grep -i java]; then
    echo 'stop'
fi

```