I am trying to execute the shell script from outside the jenkinsfile but doesn't seem to work.

```
#!/bin/bash

basePath=$1
file=$2

path=$basePath/$file
res=$("test -f $path && echo '1' || echo '0' ")

if [ $res == '1' ]
 then
...

```

The jenkinsfile is

```
        def basePath = xxx
        ...  
        stage('Prepare') {
            steps {
                script {
                    sh "chmod +x ./scripts/unzip.sh"
                    sh "./scripts/unzip.sh ${basePath} ${params.file}"
                }
            }
        }

```

I am getting an error at line `res=$("test -f $path && echo '1' || echo '0' ")` where it says `No such file or directory`. But the path is valid and it works when I run the command within the jenkinsfile.
Not sure why it is giving error when I move the code to another file.