From 2e5cdd8a31b440fc8e913579f5a5b4a369b3a293 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 28 Mar 2018 13:13:51 -0400 Subject: Use [[ ]] in zsh scripts --- link.zsh | 6 +++--- pdf.zsh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/link.zsh b/link.zsh index 42c8d04c..f5ed565c 100755 --- a/link.zsh +++ b/link.zsh @@ -1,10 +1,10 @@ #!/usr/bin/env zsh set -o errexit -o nounset -o pipefail -if [ $# -eq 1 ]; then +if [[ $# -eq 1 ]]; then linkPath="$1" filePath="$PWD/home/${linkPath#$HOME/}" - [ ! -f "$filePath" ] + [[ ! -f "$filePath" ]] mkdir -p $(dirname "$filePath") mv "$linkPath" "$filePath" fi @@ -12,7 +12,7 @@ fi find home -type f | while read findPath; do filePath="$PWD/$findPath" linkPath="$HOME/${findPath#home/}" - [ -L "$linkPath" ] && continue + [[ -L "$linkPath" ]] && continue mkdir -p $(dirname "$linkPath") ln -s "$filePath" "$linkPath" echo "$linkPath" diff --git a/pdf.zsh b/pdf.zsh index a04eda66..79e3309c 100755 --- a/pdf.zsh +++ b/pdf.zsh @@ -4,7 +4,7 @@ set -o errexit -o nounset -o pipefail mkdir -p pdf fetch() { - [ -f "pdf/$1" ] && return + [[ -f "pdf/$1" ]] && return curl --silent --show-error --output "pdf/$1" "$2" echo "pdf/$1" } -- cgit 1.4.1