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/env bash | |
## | |
## Usage: usage [command|path] | |
## Assuming that a command script file starts with a block of usage info | |
## where each line in the block starts with two '##' characters. This script | |
## extracts and displays that block of usage info. | |
## | |
## Example: | |
## Given a file a_command with the following contents: | |
## |
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/env bash | |
## | |
## Usage: afk | |
## Lock Screen on MacOS | |
## | |
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend |
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/env bash | |
# redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -euo pipefail | |
IFS=$'\n\t' | |
# `set` is safer than relying on a hashbang like `#!/bin/bash -e` | |
# because that is neutralized when someone runs the script as `bash script.sh` | |
# Exit on error. Append `|| true` if we expect an error. | |
# set -o errexit |