-L $package_path
以下代码中的意思或作用是什么?
PACKAGES=(a b c)
COLORS=(32 33 34 35 36 32)
PACKAGE_LINK_PATHS=(false false false false false false)
SECONDS=0
esc=$(printf '\e')
for index in "${!PACKAGES[@]}"
do
package_name="${PACKAGES[$index]}"
package_path="node_modules/somewhere/${package_name}"
color_code="${COLORS[$index]}"
if [ -L $package_path ]; then
if [ $unlinkPackages = true ]; then
printf "Unlinking ${package_name}\n"
else
# Cache the currently linked package path
PACKAGE_LINK_PATHS[$index]=$(readlink $package_path)
fi
rm -rf $package_path
fi
done
答案1
if [ -L
意思是“测试符号链接”。
这printf "Unlinking ${package_name}\n"
是一个很大的线索 ;)
并man bash
对此进行解释(搜索-L):
-L file True if file exists and is a symbolic link.