expect
hey, i am trying to get the username from the system in expect
but the $ is a special character reserved for expect variables. so going set username "[exec echo $USER]" of course gives me errors. does anyone know the correct way to do this? |
Rather than using $user why not use the "whoami" command.
set username "[exec whoami]" |
hi Ihave a problem in my expect script
#!/usr/local/bin/expect set User "updates" set Password "updates" set Prompt "ftp>" set Host "ftp.freedomain.com" set Yes "prompt" set Local "/home/ryan/parsedlogs/" #set Yehey "mput yehey*" ################################################# Connect to FTP spawn "/home/ryan/parsedlogs" spawn ftp $Host ################################################# Username expect "Name (ftp.freedomain.com:ryan):" send "$User\n" ################################################# Password expect "Password:" send "$Password\n" ################################################# Enter Command Option of FTP #expect "$Prompt" #send "passive\n" expect "$Prompt" send "$Yes\n" expect "$Prompt" send "hash\n" ################################################# Upload yeheylogs files expect "$Prompt\n" send "mput $Local*.*\r" expect "$Prompt" send "ls -al\n" expect "$Prompt\n" send "bye\n" when i run this script it says spawn /home/ryan/parsedlogs couldn't execute "/home/ryan/parsedlogs": permission denied while executing "spawn "/home/ryan/parsedlogs"" (file "/home/ryan/scripts/ftptest.exp" line 10) |
sk8guitar,
You can use (id -u) try to look at man id which can return you the user. at your comand type id, you see your id, uid gid and etc. try to modify it at your own preference. hope it help x2000koh |
All times are GMT -5. The time now is 02:47 PM. |