Cheshie Cheshie - 4 years ago 233
Bash Question

Can't run shell script from other shell script

I'm trying to run a shell script that calls another shell script:

#!/bin/sh

for k in `cat ../config/file1.keywords`
do
echo "*** keyword: $k ***"
./file2.sh $k
done


I got the following error:

./file2.sh: Permission denied


I tried using:
chmod +x file2.sh


When I ran my script again, I got a different error:

./file2.sh: not found


What am I missing here...? Thanks.

(I'm running on a
ubuntu 14.04 LTS
on an
Oracle VM VirtualBox
)

Answer Source

have you something like #!/bin/sh in file2.sh? If not, use sh file2.sh $kinstead of ./file2.sh $k

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download