将第三个八位字节与IP地址隔离并将其放入变量中。这条线正在进行第4次。使用/ bin / bash的macOS / AppleScript / Automator

时间:2017-12-03 20:21:25

标签: applescript ip-address automator

脚本:

read IP SIP < <(exec ifconfig en0 | awk '/inet / { t = $2; sub(/.*[.]/, "", t); print $2, t }')

我正在尝试隔离THIRD八位字节xxx.xxx.000.xxx并将其放入变量中。救命?谢谢!

2 个答案:

答案 0 :(得分:0)

简单的AppleScript解决方案

    resources :posts  
    match ':controller/:action/:id', via: [:get, :post]  
    match ':controller/:action/:id.:format', via: [:get, :post]  
    root :controller => "posts", :action => 'index'  

答案 1 :(得分:0)

以下将第三个八位字节设置为thirdOctet 变量

set thirdOctet to do shell script "ifconfig en0 | awk -F . '/inet /{print $3}'"