当使用ssh-keygen时,如果不指定默认目录,则会显示默认目录:
Enter file in which to save the key (/Users/username/.ssh/id_rsa): 我需要获得路径和文件名,“/Users/monkeypunch/..ssh/id_rsa”。
发布于 2015-01-18 07:42:06
这个怎么样:
to getDefaultKeyPath()
try
do shell script ("ssh-keygen")
on error response
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"(", ")"}
set defaultKeyPath to text item 2 of response
set AppleScript's text item delimiters to oldDelim
end try
return defaultKeyPath
end getDefaultKeyPathgetDefaultKeyPath()将返回/Users/monkeypunch/.ssh/id_rsa。
https://stackoverflow.com/questions/27995397
复制相似问题