How to execute an expect_script from shell script

Hi All,

I have written a shell script in which I am calling a expect script.

#!/usr/bin/sh
#!/usr/bin/expect -f
 
echo "Shell Start FilePush"
if [ $dmart = DVM ]
then
echo "Datamart is $dmart"
./sexpect.sh $1
echo "SFTP Over"
else
echo "Bad Argument"
fi

when I execute the script I am getting a following error.

try1.sh: line 57: ./sexpect.sh: No such file or directory

Can anyone help me to figure out where I am going wrong.

Many thanks in Advance
findnajeeb

Do you have the shell script and expect script (sexpect.sh) under same folder?

Yes its under the same folder.

post the output of this command

head -n1 sexpect.sh

also don't name your expect scripts with a .sh suffix

remove the comment "#!/usr/bin/expect -f" in the current script

Hi frank_rizzo,

[user@host archive]$ head -n1 sexpect
#!/usr/bin/expect -f

Also I removed the line below from try1.sh

#!/usr/bin/expect -f

I also tried after changing the sexpect.sh to sexpect

It didn't worked.

I really appreciate more inputs.

Thanks in Advance
findnajeeb