Improve the Shell code style.

This commit is contained in:
Cotes Chung
2020-08-19 17:05:58 +08:00
parent 038bccb3ca
commit 10ab9d3364
8 changed files with 86 additions and 85 deletions

View File

@@ -11,28 +11,28 @@
# $3 -> the destination sync directory
# Omit the system temp file
if [[ ! -f $1 ]]; then
if [[ ! -f "$1" ]]; then
exit 0
fi
src_dir=`dirname $(realpath $1)`
src_dir="$(dirname $(realpath "$1"))"
dir_prefix="$(realpath $2)/"
dir_prefix="$(realpath "$2")/"
related_dir="${src_dir:${#dir_prefix}}"
dest="$(realpath $3)/${related_dir}"
dest="$(realpath "$3")/${related_dir}"
if [[ ! -d "$dest" ]]; then
mkdir -p "$dest"
fi
if [[ -f "$1" ]]; then
cp $1 $dest
cp "$1" "$dest"
fi
if [[ $related_dir == "_posts" ]]; then
bash $3/_scripts/sh/create_pages.sh
bash $3/_scripts/sh/dump_lastmod.sh
if [[ "$related_dir" == "_posts" ]]; then
bash "$3"/_scripts/sh/create_pages.sh
bash "$3"/_scripts/sh/dump_lastmod.sh
fi