Skip to content

Instantly share code, notes, and snippets.

@allenk
Created October 24, 2022 10:06
Show Gist options
  • Save allenk/2caaf74d3be2778ab01593ec1b9fe6c3 to your computer and use it in GitHub Desktop.
Save allenk/2caaf74d3be2778ab01593ec1b9fe6c3 to your computer and use it in GitHub Desktop.
Fixed WSL2 soft link when using NTFS.
#!/bin/bash
# Allen Kuo, TEE soft-link fix for WSL2. (see my OneNote, Notion)
# echo "Bash version ${BASH_VERSION}..."
# define targets
#targets=(folder1 folder2 folder3 folder4)
targets=(myfolder)
# target start
start=1
vols=${#targets[@]}
for (( i=0; i<vols; i++ ))
do
target=${targets[$i]}
echo "Start target($i / ${vols}) ${target} ......"
if [[ -f "${target}.tar.gz" ]]; then
if [[ -d "${target}" ]]; then
echo ${target} exists, skip compress!
else
echo "${target} doesn't exist decompress ${target} ......"
tar -zxvf ./${target}.tar.gz
fi
elif [[ -d "${target}" ]]; then
echo "compress ${target} ......"
tar -czvf ${target}.tar.gz ${target}
else
echo "nothing to do for ${target} ......"
continue
fi
echo "decompress ${target} ......"
tar -zxvf ./${target}.tar.gz
echo
echo "Finish target($((i+1)) / ${vols}) ${target} ......"
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment