Skip to content

Instantly share code, notes, and snippets.

@eplord
Created April 18, 2023 23:46
Show Gist options
  • Select an option

  • Save eplord/c39ebb75fd8c318e207f7ece60d3cddb to your computer and use it in GitHub Desktop.

Select an option

Save eplord/c39ebb75fd8c318e207f7ece60d3cddb to your computer and use it in GitHub Desktop.
basic bash script helpers
#!/bin/bash
set -e
success() {
printf "\\033[32m ✔ \\033[0m\\n"
}
fail() {
printf "\\n\\033[31m ✖ \\033[0m $1\\n"
exit 1
}
doing() {
printf "\\033[33m ➜ \\033[0m $1"
}
success_msg() {
printf "\\033[33m ➜ \\033[0m $1 \\033[32m ✔ \\033[0m\\n"
}
key_missing() {
[[ $(apt-key list 2>/dev/null |
grep -i $1) ]] &&
return 1 || return 0
}
repo_missing() {
[[ $(find /etc/apt/ -name '*.list' |
xargs cat |
grep '^[[:space:]]*deb' |
grep "$1") ]] &&
return 1 || return 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment