Merge pull request #1246 from DundarGoc/test

Fixed shellcheck warning SC2164: "Use 'cd ... || exit' or 'cd ... || ……return' in case cd fails."
This commit is contained in:
Orazio 2021-02-13 12:48:30 +01:00 committed by GitHub
commit 309c2cc7d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 7 additions and 7 deletions

View file

@ -44,7 +44,7 @@ do
shift
done
cd /etc/wireguard
cd /etc/wireguard || exit
if [ ! -s configs/clients.txt ]; then
echo "::: There are no clients to change"
exit 1

View file

@ -44,7 +44,7 @@ do
shift
done
cd /etc/wireguard
cd /etc/wireguard || exit
if [ ! -s configs/clients.txt ]; then
echo "::: There are no clients to change"
exit 1

View file

@ -1,6 +1,6 @@
#!/bin/bash
cd /etc/wireguard/configs
cd /etc/wireguard/configs || exit
if [ ! -s clients.txt ]; then
echo "::: There are no clients to list"
exit 1

View file

@ -53,7 +53,7 @@ if [ ! -d "${install_home}/configs" ]; then
chmod 0750 "${install_home}/configs"
fi
cd /etc/wireguard
cd /etc/wireguard || exit
if [ -z "${CLIENT_NAME}" ]; then
read -r -p "Enter a Name for the Client: " CLIENT_NAME

View file

@ -19,7 +19,7 @@ echo -e "::::\t \e[4mInstallation settings\e[0m \t ::::"
sed "s/$pivpnHOST/REDACTED/" < ${setupVars}
printf "=============================================\n"
echo -e ":::: \e[4mServer configuration shown below\e[0m ::::"
cd /etc/wireguard/keys
cd /etc/wireguard/keys || exit
cp ../wg0.conf ../wg0.tmp
# Replace every key in the server configuration with just its file name
for k in *; do

View file

@ -27,7 +27,7 @@ do
shift
done
cd /etc/wireguard/configs
cd /etc/wireguard/configs || exit
if [ ! -s clients.txt ]; then
echo "::: There are no clients to show"
exit 1

View file

@ -40,7 +40,7 @@ do
shift
done
cd /etc/wireguard
cd /etc/wireguard || exit
if [ ! -s configs/clients.txt ]; then
echo "::: There are no clients to remove"
exit 1