Shell 脚本:从每个子目录创建 TAR,解引用符号链接
tar_each_directory.sh
for i in ../mydir/*; do
if [ -L "$i" ]; then
# Dereference the symlink
tar cvhf "$(basename "$i").tar" "$i"
else
# Regular tar without dereferencing
tar cvf "$(basename "$i").tar" "$i"
fi
doneCheck out similar posts by category:
Linux
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow