Allow args for unadd

master
Cole Deck 4 years ago
parent c3da5af055
commit 4ffe56d9cd

12
unadd

@ -1,6 +1,17 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
if [ -n "$@" ]; then
for file in $@
do
dir=$(cat ./.paths/$file)
sudo mkdir -p "$dir"
echo "$dir/$file"
sudo unlink "$dir/$file" 2>&1 > /dev/null
sudo mv "$file" "$dir"
sudo rm ./.paths/$file
done
else
for file in $(ls ./.paths) for file in $(ls ./.paths)
do do
dir=$(cat ./.paths/$file) dir=$(cat ./.paths/$file)
@ -10,6 +21,7 @@ do
sudo mv "$file" "$dir" sudo mv "$file" "$dir"
sudo rm ./.paths/$file sudo rm ./.paths/$file
done done
fi
if [ -z "$(ls ./.paths)" ]; then if [ -z "$(ls ./.paths)" ]; then
sudo rmdir ./.paths sudo rmdir ./.paths
fi fi

Loading…
Cancel
Save