I'm trying to call a AppleScript function inside of a bash script. I was able to do that but after I modified the code I'm now getting arg3 error (which is the username). I'm not sure why that failing. If any one has an idea please let me know.
Thanks! (code sample below)
!/bin/bash
!/usr/bin/osascript
APPLESCRIPT FUNC
function ASTest(){
(
osascript <<-AppleScript
on run argv
set myUser to item 3 of argv
do some more stuff from here....
....
end run
Apple Script
)
}
wireLess=$(ipconfig getifaddr $(networksetup -listallhardwareports | awk '/Hardware Port: Wi-Fi/{getline; print $2}'))
if [ -z "$wireLess" ]; then
printf "No wireless connection
";
exit 0
else
Use dig to get the network information and parse it through grep and awk. Assign the
value to the variable getName.
dig mydomain.stuff | grep "status: NOERROR"
Test to see if we have a true return value. If true, ping the network
for connectivity. If connectivity, mount shares.
if [ $? -eq 0 ]; then
ping -q -c 4 mydomain.stuff
if [ $? -eq 0 ]; then
printf "We have network connectivity
"
else
printf "We are NOT on the network
"
exit 0
fi
fi
fi
EOF"