linting fixes

This commit is contained in:
James Tomasino 2019-04-30 17:24:01 -04:00
parent 1769396340
commit 0c75b5fb66
7 changed files with 13 additions and 13 deletions

View File

@ -8,7 +8,7 @@
run_user=$(id -u)
if [ "$run_user" -eq 0 ]; then
r="$(/sbin/iptables -L f2b-sshd -n | grep REJECT)"
if [ ! -z "$r" ]; then
if [ -n "$r" ]; then
printf "%s" "$r" | awk '{print $4}' | xargs /usr/bin/fail2ban-client set sshd unbanip
fi
else

View File

@ -256,7 +256,7 @@ main() {
fi
# new message
if [ ! -z "$arg_new" ]; then
if [ -n "$arg_new" ]; then
if [ "$numships" -eq 0 ]; then
printf "No registered ships found in system.\\n"
elif [ "$numships" -eq 1 ]; then

View File

@ -6,13 +6,13 @@ if [ "$run_user" -eq 0 ]; then
s="$2"
newship="$3"
if [ ! -z "$n" ]; then
if [ -n "$n" ]; then
user_exists=$(id -u "${n}" 2> /dev/null)
if [ ! -z "${user_exists}" ]; then
if [ ! -z "${s}" ]; then
if [ -n "${user_exists}" ]; then
if [ -n "${s}" ]; then
path="/var/gopher/${s}"
if [ -d "$path" ]; then
if [ ! -z "${newship}" ]; then
if [ -n "${newship}" ]; then
newpath="/var/gopher/${newship}"
ship_exists=$(find /var/gopher -maxdepth 1 -iname "$newship")
if [ -z "$ship_exists" ]; then

View File

@ -1,5 +1,5 @@
#!/bin/sh
if [ ! -z "$1" ]; then
if [ -n "$1" ]; then
fort="$*"
printf "%s\\n%%\\n" "$fort" >> /usr/share/games/fortunes/cosmic
fi

View File

@ -4,10 +4,10 @@ run_user=$(id -u)
if [ "$run_user" -eq 0 ]; then
n="$1"
s="$2"
if [ ! -z "$n" ]; then
if [ -n "$n" ]; then
user_exists=$(id -u "${n}" 2> /dev/null)
if [ ! -z "${user_exists}" ]; then
if [ ! -z "${s}" ]; then
if [ -n "${user_exists}" ]; then
if [ -n "${s}" ]; then
path="/var/gopher/${s}"
if [ -d "$path" ]; then
printf "Removing ship '%s' for user '%s'\\n" "${s}" "${n}"

View File

@ -4,7 +4,7 @@ run_user=$(id -u)
if [ "$run_user" -eq 0 ]; then
n="$1"
k="$2"
if [ ! -z "$n" ]; then
if [ -n "$n" ]; then
user_exists=$(id -u "${n}" 2> /dev/null)
if [ -z "${user_exists}" ]; then
printf "Adding new user %s\\n" "${n}"
@ -13,7 +13,7 @@ if [ "$run_user" -eq 0 ]; then
useradd -m -G users,www-data -p "$pwcrypt" -s /bin/bash "${n}" || exit 1
sed -e "s/USERNAME/${n}/g" -e "s/PASSWORD/${newpw}/" /etc/templates/welcomemail.tmpl | sendmail "${n}"
fi
if [ ! -z "${k}" ]; then
if [ -n "${k}" ]; then
printf "%s\\n" "${k}" >> "/home/${n}/.ssh/authorized_keys"
else
${EDITOR:-vim} "/home/${n}/.ssh/authorized_keys"

View File

@ -5,7 +5,7 @@ _log() {
cur=${COMP_WORDS[COMP_CWORD]}
local helplist
helplist=$(log -z)
COMPREPLY=( $( compgen -W "$helplist" -- "$cur" ) )
mapfile -t COMPREPLY < <( compgen -W "$helplist" -- "$cur" )
}
# Detect if current shell is ZSH, and if so, load this file in bash