mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-19 14:57:04 +00:00
Improve bash quoting, and other similar best practices
This patch updates the shell scripts with some of the common best practices, which should make them more resilient to unusual failures and unexpected environments (in particular, directories with spaces). Most of these were identified by shellcheck.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
read -p "Email (full user@domain format): " EMAIL
|
||||
read -r -p "Email (full user@domain format): " EMAIL
|
||||
|
||||
if ! echo "${EMAIL}" | grep -q @; then
|
||||
echo "Error: email should have '@'."
|
||||
@@ -15,7 +15,7 @@ if ! echo "${EMAIL}" | grep -q @; then
|
||||
fi
|
||||
|
||||
|
||||
read -p "Password: " -s PASSWORD
|
||||
read -r -p "Password: " -s PASSWORD
|
||||
echo
|
||||
|
||||
DOMAIN=$(echo echo "${EMAIL}" | cut -d '@' -f 2)
|
||||
@@ -33,7 +33,7 @@ mkdir -p /data/dovecot
|
||||
touch /data/dovecot/users
|
||||
if grep -q "^${EMAIL}:" /data/dovecot/users; then
|
||||
cp /data/dovecot/users /data/dovecot/users.old
|
||||
cat /data/dovecot/users.old | grep -v "^${EMAIL}:" \
|
||||
grep -v "^${EMAIL}:" /data/dovecot/users.old \
|
||||
> /data/dovecot/users
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user