Apply CR feedback
This commit is contained in:
parent
6170e5c928
commit
4cc5418fb9
26
functions.md
26
functions.md
@ -47,29 +47,29 @@ function mkicns() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Helper functions
|
### Helper Functions
|
||||||
|
|
||||||
#### Ask user for a password
|
#### Ask User for Password
|
||||||
|
|
||||||
This function will use AppleScript to present a password entry dialog to make
|
This function will use AppleScript to present a password entry dialog to make
|
||||||
your scripts a little more user friendly.
|
your scripts a little more user friendly.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
function gui_password {
|
function gui_password {
|
||||||
if [[ -z $1 ]]; then
|
if [[ -z $1 ]]; then
|
||||||
gui_prompt="Password:"
|
gui_prompt="Password:"
|
||||||
else
|
else
|
||||||
gui_prompt="$1"
|
gui_prompt="$1"
|
||||||
fi
|
fi
|
||||||
PW=$(osascript <<EOF
|
PW=$(osascript <<EOF
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
activate
|
activate
|
||||||
text returned of (display dialog "${gui_prompt}" default answer "" with hidden answer)
|
text returned of (display dialog "${gui_prompt}" default answer "" with hidden answer)
|
||||||
end tell
|
end tell
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
echo -n "${PW}"
|
echo -n "${PW}"
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user