Skip to content

Instantly share code, notes, and snippets.

@dostanko
Last active December 12, 2015 09:38
Show Gist options
  • Save dostanko/4753243 to your computer and use it in GitHub Desktop.
Save dostanko/4753243 to your computer and use it in GitHub Desktop.
bash script asks user to enter password in Finder window to do some root actions (it was useful for me in xCode project prebuilt script)
TITLE="Please, enter root password"
DIALOG="display dialog \"$@\" default answer \"\" with title \"$TITLE\""
DIALOG="$DIALOG with icon caution with hidden answer"
result=`osascript -e 'tell application "Finder"' -e "activate" -e "$DIALOG" -e 'end tell'`
export SUDO_ASKPASS="$result" | sed -e 's/^text returned://' -e 's/, button returned:.*$//'
gem list --local compass| grep -q compass
COMPASS_INSTALLED=$?
if [ $COMPASS_INSTALLED -eq 1 ]; then
sudo gem install compass --pre
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment