Fix shellcheck findings

This commit is contained in:
Fernando Schauenburg 2024-07-14 22:16:11 +02:00
parent 44d0f1f769
commit e9b2121e65
8 changed files with 11 additions and 7 deletions

View file

@ -1,3 +1,3 @@
#!/bin/sh
# Head as much as fits on screen
exec head -n $(echo "$(tput lines) - 5" | bc) "$@"
exec head -n "$(echo "$(tput lines) - 5" | bc)" "$@"

View file

@ -9,6 +9,7 @@ error() {
[ -n "$1" ] || error "input file missing"
[ -r "$1" ] || error "can't read input file"
# shellcheck disable=SC2016 # I don't want $(tty) to be expanded
printf '#!/bin/sh
GPG_TTY=$(tty)
export GPG_TTY

View file

@ -2,7 +2,7 @@
usage() {
echo "Usage:
$(basename $0) [-h] <volume> -- generate /etc/fstab entry to prevent automount on macOS
$(basename "$0") [-h] <volume> -- generate /etc/fstab entry to prevent automount on macOS
where:
-h print this help

View file

@ -1,3 +1,3 @@
#!/bin/sh
# Tail as much as fits on screen
exec tail -n $(echo "$(tput lines) - 5" | bc) "$@"
exec tail -n "$(echo "$(tput lines) - 5" | bc)" "$@"

View file

@ -1,6 +1,6 @@
#!/bin/bash
scriptname=`basename "$0"`
scriptname=$(basename "$0")
usage() {
echo "Usage: $scriptname SHARE [...]"
@ -15,7 +15,7 @@ mount_share() {
share="$1"
sudo mkdir "/mnt/$share"
sudo chmod 777 "/mnt/$share"
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) "$share" "/mnt/$share"
sudo mount -t vboxsf -o uid=$UID,gid="$(id -g)" "$share" "/mnt/$share"
}
main() {

View file

@ -150,7 +150,7 @@ main() {
while getopts 'hny' opt; do
case "$opt" in
n) # dry run
cmd='echo'
CMD='echo'
echo "${yellow}Performing dry run (no changes will be made).${sgr0}"
echo
;;

View file

@ -1,3 +1,7 @@
# shellcheck shell=sh
# shellcheck disable=SC2034 # Variables defined here are meant to be used in the
# script that sources this file.
# Where to install the dotfiles, usually $HOME.
DESTDIR="$HOME"

View file

@ -39,7 +39,6 @@ setup_commands() {
GIT="${dry}git"
GZIP="${dry}gzip"
HELP2MAN="${dry}help2man"
LN="${dry}ln"
MKDIR="${dry}mkdir"
MV="${dry}mv"
PANDOC="${dry}pandoc"