More consistent $ escapes

This commit is contained in:
Andrejus
2020-02-26 14:56:03 +00:00
parent 6b7736c41b
commit 9ee236cbb7
5 changed files with 12 additions and 11 deletions

View File

@@ -17,7 +17,7 @@ fi
# Prevent concurrent runs # Prevent concurrent runs
readonly install_lock_file="$dotfiles_dir/.dotlock" readonly install_lock_file="$dotfiles_dir/.dotlock"
if [ -f $install_lock_file ]; then if [ -f "$install_lock_file" ]; then
printf "Failed: ${C_RED}Script already running${C_NC}\n" printf "Failed: ${C_RED}Script already running${C_NC}\n"
printf "Please wait for script to exit or ${C_YELLOW}make clean${C_NC}\n" printf "Please wait for script to exit or ${C_YELLOW}make clean${C_NC}\n"
exit 1 exit 1
@@ -27,13 +27,13 @@ touch "$install_lock_file" # Requires clean
# Run all install scripts # Run all install scripts
readonly install_dir="$dotfiles_dir/install" readonly install_dir="$dotfiles_dir/install"
readonly script_filter="$install_dir/*.sh" readonly script_filter="$install_dir/*.sh"
for script in $script_filter; do for script in "$script_filter"; do
# Avoid pattern matching self # Avoid pattern matching self
[ -e "$script" ] || continue [ -e "$script" ] || continue
# Log execution # Log execution
script_name=$(basename "$script" ".sh") script_name="$(basename "$script" ".sh")"
printf "Running ${C_YELLOW}$script_name${C_NC}...\n${C_DGRAY}" printf "Running ${C_YELLOW}$script_name${C_NC}...\n${C_DGRAY}"
# Run and indent output # Run and indent output

View File

@@ -11,5 +11,5 @@ update
upgrade upgrade
# Package installs # Package installs
readonly package_list=$(cat $install_dir/$package_list_file) readonly package_list="$(cat $install_dir/$package_list_file)"
install -y "$package_list" install -y "$package_list"

View File

@@ -23,7 +23,7 @@ printf "fish is installed\n"
fish --version fish --version
# 2. fish shell is default login shell # 2. fish shell is default login shell
readonly fish_path=$(which fish) readonly fish_path="$(which fish)"
if [ "$SHELL" != fish_path ]; then if [ "$SHELL" != fish_path ]; then
# Update default login shell # Update default login shell

View File

@@ -41,7 +41,8 @@ if not_installed "docker-compose"; then
printf "Installing docker-compose...\n" printf "Installing docker-compose...\n"
# Docker-compose # Docker-compose
curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose readonly docker_compose_url="https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m)"
curl -L docker_compose_url -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
fi fi
@@ -56,7 +57,7 @@ fi
printf "group '$docker_group' is created\n" printf "group '$docker_group' is created\n"
# 4. user is in docker group # 4. user is in docker group
if ! groups $USER | grep -q "\b$docker_group\b"; then if ! groups "$USER" | grep -q "\b$docker_group\b"; then
sudo usermod -aG docker "$USER" sudo usermod -aG docker "$USER"
fi fi
printf "user '$USER' is in '$docker_group' group\n" printf "user '$USER' is in '$docker_group' group\n"

View File

@@ -17,7 +17,7 @@ upgrade() {
# @arg $1 packages to install # @arg $1 packages to install
install() { install() {
sudo apt-get install -y $1 sudo apt-get install -y "$1"
} }
# @arg $1 repository to add # @arg $1 repository to add
@@ -27,13 +27,13 @@ app_ppa() {
# @arg $1 url to add # @arg $1 url to add
add_key() { add_key() {
curl -fsSL $1 | sudo apt-key add - curl -fsSL "$1" | sudo apt-key add -
} }
# @arg $1 URL to run # @arg $1 URL to run
# @arg $2 binary to use # @arg $2 binary to use
run() { run() {
curl -fsSL $1 | $2 curl -fsSL "$1" | "$2"
} }
# Symlink contents of source folder to target # Symlink contents of source folder to target
@@ -41,7 +41,7 @@ run() {
# @arg $1 source folder # @arg $1 source folder
# @arg $2 target folder # @arg $2 target folder
link_folder() { link_folder() {
cp -srf $1 $2 cp -srf "$1" "$2"
} }
indent() { sed 's/^/ /'; } indent() { sed 's/^/ /'; }