Skip to content

Instantly share code, notes, and snippets.

@grahamc
Created April 25, 2021 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamc/b572fbae1782b512bec3b17b55b9c768 to your computer and use it in GitHub Desktop.
Save grahamc/b572fbae1782b512bec3b17b55b9c768 to your computer and use it in GitHub Desktop.
#!/bin/bash
jq -cMr '.contents[] | [.object, .symlink][]' < .attrs.json \
| (
declare -a left
while read -r obj && read -r sym; do
if [ "$sym" != null ]; then
mkdir -p "root/$(dirname "$sym")"
ln -s "$obj" "root/$sym"
fi
left+=("$obj")
echo ''${#left[@]}
done
echo ''${#left[@]}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment