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
| path="$(pwd)"; while [ "$path" != "/" ]; do [ -L "$path" ] && { echo "$path is a symlink"; break ;} ; echo "OK - $path"; path="$(dirname $path)"; done |
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
| p/help_main() { | |
| cat <<-EOF | |
| vault - hungry hungry AES hippo | |
| Usage: | |
| vault [-f|--passphrase-file <path>] [-d|--vault-dir <path>] <command> | |
| [--] [[cubby/]entity...] | |
| Options: |
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
| # error code is in red, starting with \e[31m and ending with \e[0m escape codes. | |
| # only non-zero exit codes appear. | |
| export PS1='[\u@\h \W]\[\e[31m${?#0}\e[0m\]\$ ' |
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
| Host github.com | |
| StrictHostKeyChecking no | |
| UserKnownHostsFile /dev/null | |
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
| main(){ | |
| set -eo pipefail | |
| local path="${BASH_SOURCE[0]}" | |
| while [ -L "$path" ] ; do path="$(readlink "$path")" ; done | |
| readonly CWD="$( pwd -P )" | |
| readonly SCRIPT_CWD="$( cd $(dirname ${path}) ; pwd -P )" | |
| # CWD is your current CWD | |
| # SCRIPT_CWD is the resolved path of the actual script | |
| # ^^^ works on BSD/Darwin + GNU linux |
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
| #!/usr/bin/env bash | |
| get/value(){ | |
| echo "error getting value" >&2 | |
| return 66 | |
| } | |
| main(){ | |
| local lvar=$(get/value) || echo "local var assignment error" | |
| var=$(get/value) || echo "global var assignment error" |
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
| #!/usr/bin/env bash | |
| set -e | |
| cleanup(){ | |
| echo "I am cleanup with status $?" | |
| } | |
| # use trap for subshell, because; | |
| # ( false; echo "i should not appear" ; ) || cleanup |
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
| #!/usr/bin/env bash | |
| # Example Usage: | |
| # ./test.sh a "bcd" "e with \"quot'es\"." f | |
| printf "recieved: %s \n\n" "$@" | |
| a1=( "$@" ) | |
| a2=( $@ ) |
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
| #!/usr/bin/env bash | |
| # prex.sh - pre extraction payload, expects .tar.gz contents following #@TARGZ. | |
| # usage: concatenate .tar.gz contents, and make executable: | |
| # cat prex.sh /path/to/tar.gz > payload.sh && chmod +x payload.sh | |
| # | |
| # pre-extract payload | |
| # | |
| echo "extracting $0 ..." |
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
| [color] | |
| ui = true | |
| branch = auto | |
| diff = auto | |
| status = auto | |
| [color "branch"] | |
| current = yellow reverse | |
| local = yellow | |
| remote = green |