Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Applescript 从ssh keygen获取默认位置?_Applescript_Ssh Keygen - Fatal编程技术网

Applescript 从ssh keygen获取默认位置?

Applescript 从ssh keygen获取默认位置?,applescript,ssh-keygen,Applescript,Ssh Keygen,使用ssh keygen时,如果未指定默认目录,则显示默认目录: Enter file in which to save the key (/Users/username/.ssh/id_rsa): 我需要获取路径和文件名“/Users/monkeypunch/.ssh/id\u rsa” 这个怎么样: to getDefaultKeyPath() try do shell script ("ssh-keygen") on error response

使用ssh keygen时,如果未指定默认目录,则显示默认目录:

Enter file in which to save the key (/Users/username/.ssh/id_rsa): 
我需要获取路径和文件名“/Users/monkeypunch/.ssh/id\u rsa”

这个怎么样:

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 getDefaultKeyPath
getDefaultKeyPath()将返回
/Users/monkeypunch/.ssh/id\u rsa