expect : creating a folder with a timestamp in a send command
Hello,
I'm working on an AIX 5.3 mainframe. I have to automatically send files with sftp. I choose the expect way, here is my code : Code:
#!/usr/bin/expect -d -f output result for the mkdir part : send: sending "mkdir date +%Y%m%d%H%M%S\n" to { exp4 } This is simply creating a "date" folder :( You can see my first attempt : Code:
#set my_command `date +%Y%m%d%H%M%S` ... executing commands from command file ./test_expect.sh wrong # args: should be "set varName ?newValue?" while executing "set mydate `date +%Y%m%d%H%M%S`" (file "./test_expect.sh" line 3) Do you have an idea how I can do this ? With another shell script without the expect stuff it is working as expected ? Thanks in advance, Greg. |
Something like this?
Code:
#!/usr/local/bin/bash |
Hi,
Thanks for your help. I don't have bash shell installed I think : Current available shells: /bin/sh /bin/bsh /bin/csh /bin/ksh /bin/tsh /bin/ksh93 /usr/bin/sh /usr/bin/bsh /usr/bin/csh /usr/bin/ksh /usr/bin/tsh /usr/bin/ksh93 /usr/bin/rksh /usr/bin/rksh93 /usr/sbin/uucp/uucico /usr/sbin/sliplogin /usr/sbin/snappd I replaced the first line with #!/usr/bin/bsh Then I have this : ./sftp_send.sh: syntax error at line 3: `MYDATE=$' unexpected ? |
It should work with the default AIX shell (/bin/sh)
|
Hi thanks you a lot this made my day :)
Just one more thing, do you know how I can log the expect stuff in a file ? I need a logfile to proof I've uploaded the files :) |
With redirection?
Code:
#!/bin/sh Code:
$ cat /tmp/ftp.20130829122051.log |
Thank you again it is perfect :)
|
All times are GMT -5. The time now is 02:24 AM. |