diff --git a/bin/key-check b/bin/key-check index 07c84a3..477beea 100755 --- a/bin/key-check +++ b/bin/key-check @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash trap "exit 1" TERM export TOP_PID=$$ @@ -79,7 +79,7 @@ incorrect_number_of_arguments () { test $ARG_COUNT -ne 3 } -is_file () { +file? () { local readonly file=$1 [[ -f $file ]] @@ -94,15 +94,15 @@ main () { usage fi - if ! is_file $certificate; then + if ! file? $certificate; then file_error $certificate fi - if ! is_file $key; then + if ! file? $key; then file_error $key fi - if ! is_file $csr; then + if ! file? $csr; then file_error $csr fi diff --git a/bin/ssh-hosts b/bin/ssh-hosts index 8aa19f9..b0524de 100755 --- a/bin/ssh-hosts +++ b/bin/ssh-hosts @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash IFS=$'\n' readonly PROGRAM_NAME=$(basename $0) diff --git a/bin/watchd b/bin/watchd index b4ffcbb..52786c8 100755 --- a/bin/watchd +++ b/bin/watchd @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash readonly PROGRAM_NAME=$(basename "$0") readonly PROGRAM_LOC=$(readlink -m "$(dirname $0)") @@ -37,34 +37,34 @@ alert_update () { echo "[$now] Directory Updated" } -is_dir? () { +directory? () { local readonly directory=$1; shift [[ -d $directory ]] } -is_int? () { +integer? () { local readonly number=$1; shift [[ $number =~ ^[0-9]+$ ]] } -is_empty? () { +empty? () { local var=$1; shift [[ -z $var ]] } check_arguments () { - if is_empty? "$DIRECTORY" || is_empty? "$WAIT_TIME"; then + if empty? "$DIRECTORY" || empty? "$WAIT_TIME"; then error "missing operand" fi - if ! is_dir? "$DIRECTORY"; then + if ! directory? "$DIRECTORY"; then error "$DIRECTORY is not a directory" fi - if ! is_int? "$WAIT_TIME"; then + if ! integer? "$WAIT_TIME"; then error "$WAIT_TIME is not an integer" fi } diff --git a/bin/whatthecommit b/bin/whatthecommit index 30a111d..3b6fdbd 100755 --- a/bin/whatthecommit +++ b/bin/whatthecommit @@ -1,4 +1,9 @@ #!/usr/bin/env bash git add . -curl -s whatthecommit.com | sed 's/<[^>]\+>//g' | sed '1,39d' | head -1 | xargs -0 git commit -m + +curl -s whatthecommit.com \ + | sed 's/<[^>]\+>//g' \ + | sed '1,39d' \ + | head -1 \ + | xargs -0 git commit -m