bash

Bash - Snippets

some Bash snippets Change Working Directory #!/usr/bin/env bash script_path=$(dirname "$0") cd "$script_path" sha256: 14702c6f56acf7fb0c71b5e04b7c9de9264ed0dbbef43c34e34ec12fbd6e8baa

Keepalive

Little Keep Alive … mit freundlicher genehmigung von Kumpel Marc :) keepalive.sh #!/usr/bin/env bash FILE="$HOME/scripts/excuses" # Linux or BSD ? nf points to the right binary which numfmt > /dev/null 2>&1 && nf=$(which numfmt) || nf=$(which gnumfmt); # Linux or BSD ? gs points to the right binary which shuf > /dev/null 2>&1 && gs=$(which shuf) || gs=$(which gshuf); if [ ! -e "$FILE" ]; then echo "" echo "$FILE does not exist" echo "##############################################" command -v curl >/dev/null 2>&1 || { echo >&2 "Holy cow!