Random minor cleanups
This commit is contained in:
parent
5369623e77
commit
fdd9bf1a1f
4 changed files with 19 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
trap "exit 1" TERM
|
trap "exit 1" TERM
|
||||||
export TOP_PID=$$
|
export TOP_PID=$$
|
||||||
|
@ -79,7 +79,7 @@ incorrect_number_of_arguments () {
|
||||||
test $ARG_COUNT -ne 3
|
test $ARG_COUNT -ne 3
|
||||||
}
|
}
|
||||||
|
|
||||||
is_file () {
|
file? () {
|
||||||
local readonly file=$1
|
local readonly file=$1
|
||||||
|
|
||||||
[[ -f $file ]]
|
[[ -f $file ]]
|
||||||
|
@ -94,15 +94,15 @@ main () {
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! is_file $certificate; then
|
if ! file? $certificate; then
|
||||||
file_error $certificate
|
file_error $certificate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! is_file $key; then
|
if ! file? $key; then
|
||||||
file_error $key
|
file_error $key
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! is_file $csr; then
|
if ! file? $csr; then
|
||||||
file_error $csr
|
file_error $csr
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
|
|
||||||
readonly PROGRAM_NAME=$(basename $0)
|
readonly PROGRAM_NAME=$(basename $0)
|
||||||
|
|
14
bin/watchd
14
bin/watchd
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
readonly PROGRAM_NAME=$(basename "$0")
|
readonly PROGRAM_NAME=$(basename "$0")
|
||||||
readonly PROGRAM_LOC=$(readlink -m "$(dirname $0)")
|
readonly PROGRAM_LOC=$(readlink -m "$(dirname $0)")
|
||||||
|
@ -37,34 +37,34 @@ alert_update () {
|
||||||
echo "[$now] Directory Updated"
|
echo "[$now] Directory Updated"
|
||||||
}
|
}
|
||||||
|
|
||||||
is_dir? () {
|
directory? () {
|
||||||
local readonly directory=$1; shift
|
local readonly directory=$1; shift
|
||||||
|
|
||||||
[[ -d $directory ]]
|
[[ -d $directory ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
is_int? () {
|
integer? () {
|
||||||
local readonly number=$1; shift
|
local readonly number=$1; shift
|
||||||
|
|
||||||
[[ $number =~ ^[0-9]+$ ]]
|
[[ $number =~ ^[0-9]+$ ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
is_empty? () {
|
empty? () {
|
||||||
local var=$1; shift
|
local var=$1; shift
|
||||||
|
|
||||||
[[ -z $var ]]
|
[[ -z $var ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
check_arguments () {
|
check_arguments () {
|
||||||
if is_empty? "$DIRECTORY" || is_empty? "$WAIT_TIME"; then
|
if empty? "$DIRECTORY" || empty? "$WAIT_TIME"; then
|
||||||
error "missing operand"
|
error "missing operand"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! is_dir? "$DIRECTORY"; then
|
if ! directory? "$DIRECTORY"; then
|
||||||
error "$DIRECTORY is not a directory"
|
error "$DIRECTORY is not a directory"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! is_int? "$WAIT_TIME"; then
|
if ! integer? "$WAIT_TIME"; then
|
||||||
error "$WAIT_TIME is not an integer"
|
error "$WAIT_TIME is not an integer"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
git add .
|
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
|
||||||
|
|
Loading…
Reference in a new issue