192.168.#!/bin/bash
#
result=$(/usr/bin/osascript -e "set buttonList to {\"192.168.0.10\", \"192.168.0.12\", \"192.168.0.4\", \"192.168.0.2\", \"192.168.1.3\", \"192.168.1.6\"}
set chosenItems to choose from list buttonList with title \"请选择按钮\" with prompt \"请从下列选项中选择一个:\" default items {\"192.168.0.10\"}
if chosenItems is false then
set chosenButton to \"\"
else
set chosenButton to item 1 of chosenItems
end if
return chosenButton ")
share_ip=$result
if [ -z $share_ip ];then
exit 0;
fi
#mac=$(sudo networksetup -getinfo Wi-Fi | grep Wi-Fi | awk '{print $NF}')
#gh=$(sudo security find-generic-password -l "${ssid}" | grep "acct" | grep blob | sed 's/"//g' | cut -d "=" -f 2)
#pwd=$(sudo security find-generic-password -l "${ssid}" -w)
#open "smb://${gh}:${pwd}@${share_ip}"
strings=("AAAA-OOO" "AAAA-PPP" "AAAA-QQQ" "AAAA-RRR" "AAAA-SSS" "AAAA-TTT" "AAAA-UUU" "AAAA-VVV")
for string in "${strings[@]}"
do
security find-generic-password -l "$string"
#(/usr/bin/osascript -e 'display dialog "AAA" buttons {"OK"} default button "OK"')
if [ $? = 0 ];then
# 在这里可以执行对每个字符串的操作
gh=$(security find-generic-password -l "${string}" | grep "acct" | grep blob | sed 's/"//g' | cut -d "=" -f 2)
#(/usr/bin/osascript -e 'display dialog "BBB" buttons {"OK"} default button "OK"')
pwd=$(security find-generic-password -l "${string}" -w)
#(/usr/bin/osascript -e 'display dialog "CCC" buttons {"OK"} default button "OK"')
pwd=$(echo "$pwd" | sed 's/@/%40/g')
open "smb://${gh}:${pwd}@${share_ip}"
exit 0;
fi
done
open "smb://${share_ip}"