Skip to content

Instantly share code, notes, and snippets.

@wsgzao
Created October 25, 2019 10:57
Show Gist options
  • Save wsgzao/0ef320a331a2eca8da8f745d116592ef to your computer and use it in GitHub Desktop.
Save wsgzao/0ef320a331a2eca8da8f745d116592ef to your computer and use it in GitHub Desktop.
Get symlink real path and copy nginx site-enabled files to new place
#!/bin/bash
dir_new="/tmp/wangao/*/sites-enabled/"
for link in $(find ./ -type l)
do
echo
echo "Link is:"
echo $link
realpath=$(readlink -f $link)
echo $dir
# rm $link
# cp $realpath $link -rf
cp --remove-destination $realpath $dir_new
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment