Last active
April 28, 2016 22:58
-
-
Save krispayne/b0ba3c0f3400a5f715aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Provide user info about the computer | |
# Kris Payne | |
# run this shiz in a policy in Self Service. It will let the user copy their IP or Computer name for you. | |
# slower than >System Preferences>Network ? Yes. Easier to explain? Yes. | |
# Definitions | |
thisComputerName="scutil --get ComputerName | pbcopy" | |
thisIPAddress=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk {'print $2'} | pbcopy) | |
CD="/Applications/Utilities/CocoaDialog.app/Contents/MacOS/cocoaDialog" | |
# Script | |
printIPAddress="$thisIPAddress" | |
dialogBox=$($CD msgbox --no-newline \ | |
--title "Computer Information" \ | |
--text "Please select an option below:" \ | |
--button1 "Copy Computer Name" --button2 "Copy IP Address" --button3 "Cancel") | |
if [ "$dialogBox" == "1" ]; then | |
# Get the computer name from SCUtil and then copy it to the default clipboard | |
eval "$thisComputerName" | |
elif [ "$dialogBox" == "2" ]; then | |
# Get the IP Address from ifconfig and then copy it to the default clipboard | |
eval "$printIPAddress" | |
elif [ "$dialogBox" == "3" ]; then | |
# print a snarky message | |
echo "Nevermind" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment