1
0
Fork 0

Random minor cleanups

This commit is contained in:
Andrew Tomaka 2015-03-06 09:12:26 -05:00
parent 5369623e77
commit fdd9bf1a1f
4 changed files with 19 additions and 14 deletions

View file

@ -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

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
IFS=$'\n'
readonly PROGRAM_NAME=$(basename $0)

View file

@ -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
}

View file

@ -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