It appears your are trying to execute an expect program using a shell interpreter. expect is a different language and must be executed using the expect
interpreter.
How to pass a variable name in cd command linux [closed]
Question
I have a connection to a SFTP in a shell script but when i try to get some files passing variable name but sends me an error. My code:
set date_file_format [timestamp -format %C%y%m%d]
#some code
expect "sftp>"
send "mget /home/dir/*$date_file_format*.dat /home2/user/dir2 \r"
date_file_format is = 20140117
I want to get all files that contains "20140117" and extension .dat using a wildcard *$date_file_format*.dat
This is the error:
sftp> usage: send [args] string
while executing
"send "mget /home/dir/*$date_file_format*.dat /home2/user/dir2 \r""
(file "./bash.sh" line 15)
Any idea why it is happening?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow