diff --git a/.ci/scripts/test_export_data_command.sh b/.ci/scripts/test_export_data_command.sh
index 75f5811d10d0cb4e69a15dfd7bcfa97f90139851..2180072c06f942debd108dd64a3238c03cbef208 100755
--- a/.ci/scripts/test_export_data_command.sh
+++ b/.ci/scripts/test_export_data_command.sh
@@ -3,7 +3,7 @@
 # Test for the export-data admin command against sqlite and postgres
 
 set -xe
-cd `dirname $0`/../..
+cd "`dirname $0`/../.."
 
 echo "--- Install dependencies"
 
diff --git a/.ci/scripts/test_synapse_port_db.sh b/.ci/scripts/test_synapse_port_db.sh
index 50115b3079a814fd8edf60a3766909c91898950c..7bcbe63654c999f6d596ffed6d23be63216ec5d4 100755
--- a/.ci/scripts/test_synapse_port_db.sh
+++ b/.ci/scripts/test_synapse_port_db.sh
@@ -7,7 +7,7 @@
 
 
 set -xe
-cd `dirname $0`/../..
+cd "`dirname $0`/../.."
 
 echo "--- Install dependencies"
 
diff --git a/debian/test/provision.sh b/debian/test/provision.sh
index a5c7f59712a1a360533cefa5eb376a6cffa6accf..9dc8ab671cc0ae78768c8e8f4bac44f67b8fd2bd 100644
--- a/debian/test/provision.sh
+++ b/debian/test/provision.sh
@@ -10,7 +10,7 @@ set -e
 apt-get update
 apt-get install -y lsb-release
 
-deb=`ls /debs/matrix-synapse-py3_*+$(lsb_release -cs)*.deb | sort | tail -n1`
+deb=`ls "/debs/matrix-synapse-py3_*+$(lsb_release -cs)*.deb" | sort | tail -n1`
 
 debconf-set-selections <<EOF
 matrix-synapse matrix-synapse/report-stats boolean false
diff --git a/demo/start.sh b/demo/start.sh
index fc5d08a63b26fd0f96d4f86fa5b1d0ac931a8367..e426094994869b8802eb917ca8f43786fc548071 100755
--- a/demo/start.sh
+++ b/demo/start.sh
@@ -8,7 +8,7 @@ cd "$DIR/.." || exit
 
 mkdir -p demo/etc
 
-export PYTHONPATH=$(readlink -f $(pwd))
+export PYTHONPATH=$(readlink -f "$(pwd)")
 
 
 echo $PYTHONPATH
diff --git a/scripts-dev/check_line_terminators.sh b/scripts-dev/check_line_terminators.sh
index 762f848cab7d639573d6cc36e727ad167cbcf40c..068f157ea12b168e19942e4004edc686edaca920 100755
--- a/scripts-dev/check_line_terminators.sh
+++ b/scripts-dev/check_line_terminators.sh
@@ -25,7 +25,7 @@
 # terminators are found, 0 otherwise.
 
 # cd to the root of the repository
-cd `dirname $0`/.. || exit
+cd "`dirname $0`/.." || exit
 
 # Find and print files with non-unix line terminators
 if find . -path './.git/*' -prune -o -type f -print0 | xargs -0 grep -I -l $'\r$'; then
diff --git a/scripts-dev/config-lint.sh b/scripts-dev/config-lint.sh
index 6b160c8ad2cd5114f3c97980a84c05919ff915bd..15c8c2f93a46601f9e92c930ac5943084f0c787e 100755
--- a/scripts-dev/config-lint.sh
+++ b/scripts-dev/config-lint.sh
@@ -3,7 +3,7 @@
 # Exits with 0 if there are no problems, or another code otherwise.
 
 # cd to the root of the repository
-cd `dirname $0`/.. || exit
+cd "`dirname $0`/.." || exit
 
 # Restore backup of sample config upon script exit
 trap "mv docs/sample_config.yaml.bak docs/sample_config.yaml" EXIT
diff --git a/scripts-dev/docker_update_debian_changelog.sh b/scripts-dev/docker_update_debian_changelog.sh
index 89821bba72a612fb15c02e28286b0ed3c927e2ca..14c155aee57c54d0fcbf6f2c517abd77fdf047e0 100755
--- a/scripts-dev/docker_update_debian_changelog.sh
+++ b/scripts-dev/docker_update_debian_changelog.sh
@@ -60,5 +60,5 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y devscripts
 
 # Update the Debian changelog.
 ver=${1}
-dch -M -v $(sed -Ee 's/(rc|a|b|c)/~\1/' <<<$ver) "New synapse release $ver."
+dch -M -v "$(sed -Ee 's/(rc|a|b|c)/~\1/' <<<$ver)" "New synapse release $ver."
 dch -M -r -D stable ""
diff --git a/scripts-dev/generate_sample_config b/scripts-dev/generate_sample_config
index 02739894b595f41844888ce9e885b50c1cc1cbbc..06e4c8c669b77e4337e3d6f2a95c8f631e2032c4 100755
--- a/scripts-dev/generate_sample_config
+++ b/scripts-dev/generate_sample_config
@@ -4,7 +4,7 @@
 
 set -e
 
-cd `dirname $0`/..
+cd "`dirname $0`/.."
 
 SAMPLE_CONFIG="docs/sample_config.yaml"
 SAMPLE_LOG_CONFIG="docs/sample_log_config.yaml"