summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-07 21:48:11 -0500
committerJune McEnroe <june@causal.agency>2020-12-07 21:48:11 -0500
commitf30aa4c382821fd33ae12e091287899c45f2c7f6 (patch)
treea680ba875f23bf95be2ff89e771ade2c226da118 /bin
parentAdd I Feel It All (diff)
downloadsrc-f30aa4c382821fd33ae12e091287899c45f2c7f6.tar.gz
src-f30aa4c382821fd33ae12e091287899c45f2c7f6.zip
Clean up variable expansions in c.sh
Diffstat (limited to 'bin')
-rw-r--r--bin/c.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/c.sh b/bin/c.sh
index 6d2b6b35..f1143fd3 100644
--- a/bin/c.sh
+++ b/bin/c.sh
@@ -2,7 +2,7 @@
 set -eu
 
 temp=$(mktemp -d)
-trap 'rm -r "$temp"' EXIT
+trap 'rm -r "${temp}"' EXIT
 
 exec 3>>"${temp}/run.c"
 
@@ -28,8 +28,9 @@ cat >&3 <<EOF
 #include <unistd.h>
 EOF
 
+expr=
 while getopts 'e:i:' opt; do
-	case "$opt" in
+	case "${opt}" in
 		(e) expr=$OPTARG;;
 		(i) echo "#include <${OPTARG}>" >&3;;
 		(?) exit 1;;
@@ -44,7 +45,7 @@ int main(int argc, char *argv[]) {
 	$*;
 EOF
 
-if [ -n "${expr:-}" ]; then
+if [ -n "${expr}" ]; then
 	cat >&3 <<EOF
 	printf(
 		_Generic(
@@ -72,7 +73,7 @@ if [ -n "${expr:-}" ]; then
 EOF
 fi
 
-if [ $# -eq 0 -a -z "${expr:-}" ]; then
+if [ $# -eq 0 -a -z "${expr}" ]; then
 	cat >&3
 fi