0

For loop is not working with expect in pgp encyption script.

=========

-bash-4.1$ more TestScriptPGP.sh

!/bin/bash

!/usr/bin/expect -f

for i in ls *.txt
do
spawn /opt/PGP/pgp -e +force $i "<abc@gmail.com>"
expect "Are you sure you want to use"
send "y\n"
expect "$"
done;
-bash-4.1$ ./TestScriptPGP.sh
./TestScriptPGP.sh: line 5: spawn: command not found
couldn't read file "Are you sure you want to use": no such file or directory
./TestScriptPGP.sh: line 7: send: command not found
couldn't read file "$": no such file or directory
./TestScriptPGP.sh: line 5: spawn: command not found
couldn't read file "Are you sure you want to use": no such file or directory
./TestScriptPGP.sh: line 7: send: command not found
couldn't read file "$": no such file or directory
./TestScriptPGP.sh: line 5: spawn: command not found
couldn't read file "Are you sure you want to use": no such file or directory
./TestScriptPGP.sh: line 7: send: command not found
couldn't read file "$": no such file or directory
./TestScriptPGP.sh: line 5: spawn: command not found
couldn't read file "Are you sure you want to use": no such file or directory
./TestScriptPGP.sh: line 7: send: command not found
couldn't read file "$": no such file or directory
-bash-4.1$

=================

3
Contributors
2
Replies
11
Views
2 Years
Discussion Span
Last Post by Roger_4
0

Hello,

Seen this many times before and used to drive me crazy, the ls command is aliased to ls --color and the escape codes are showing up as part of the file names. Try using /bin/ls and you should be fine.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.