shell expect 拷贝文件夹有问题

 

79 # $1 dest path
80 # $2 source path plus /home/zhangyi/work/psoc_linux/SDK_release/
81 function sudocopy()
82 {
83 cp_path=$1
84 dir_no=$2
85 
86 # bad
87 /usr/bin/expect <<EOF
88 spawn sudo cp -r "${SERVER_RELEASE_PATH}/${dir_no}" "${cp_path}"
89 expect "zhangyi:"
90 send "1234qwer\r"
91 expect eof
92 EOF
93
94 
95 
96 }
97

 

79 # $1 dest path
80 # $2 source path plus /home/zhangyi/work/psoc_linux/SDK_release/
81 function sudocopy()
82 {
83 cp_path=$1
84 dir_no=$2
85 
86 # ok
87 /usr/bin/expect <<EOF
88 spawn sudo ls
89 expect "zhangyi:"
90 send "1234qwer\r"
91 expect eof
92 EOF
93 sudo cp -r "${SERVER_RELEASE_PATH}/${dir_no}" "${cp_path}"
94 
95 
96 }

79 # $1 dest path
80 # $2 source path plus /home/zhangyi/work/psoc_linux/SDK_release/
81 function sudocopy()
82 {
83 cp_path=$1
84 dir_no=$2
#ok
95 echo "1234qwer" | sudo -S cp -r "${SERVER_RELEASE_PATH}/${dir_no}" "${cp_path}"
96 }

 

上一篇:shell入门(五)


下一篇:Mac配置jdk以及maven