Last active
December 14, 2016 08:49
-
-
Save T1T4N/01f5aa904e07c53c0513993c418c43bf to your computer and use it in GitHub Desktop.
gksudo implementation for macOS
This file contains 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
#!/usr/bin/osascript | |
on convertListToString(theList, theDelimiter) | |
set output to (item 1 of theList) | |
if (count theList) > 1 then | |
set theList to items 2 through (count theList) of theList | |
repeat with listItem in theList | |
set parsedItem to listItem | |
if space is in listItem then | |
set parsedItem to (quoted form of listItem) | |
end if | |
set output to output & theDelimiter & (parsedItem) | |
end repeat | |
end if | |
return output | |
end convertListToString | |
on run argv | |
if (count argv) < 1 then | |
log "Script is missing arguments" | |
error | |
end if | |
set parsedCommand to convertListToString(argv, space) | |
log "Running command: " & parsedCommand | |
set ret to (do shell script parsedCommand with administrator privileges without altering line endings) | |
return ret | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment