Allow args for unadd
parent
c3da5af055
commit
4ffe56d9cd
@ -1,15 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
for file in $(ls ./.paths)
|
if [ -n "$@" ]; then
|
||||||
do
|
for file in $@
|
||||||
dir=$(cat ./.paths/$file)
|
do
|
||||||
sudo mkdir -p "$dir"
|
dir=$(cat ./.paths/$file)
|
||||||
echo "$dir/$file"
|
sudo mkdir -p "$dir"
|
||||||
sudo unlink "$dir/$file" 2>&1 > /dev/null
|
echo "$dir/$file"
|
||||||
sudo mv "$file" "$dir"
|
sudo unlink "$dir/$file" 2>&1 > /dev/null
|
||||||
sudo rm ./.paths/$file
|
sudo mv "$file" "$dir"
|
||||||
done
|
sudo rm ./.paths/$file
|
||||||
|
done
|
||||||
|
else
|
||||||
|
for file in $(ls ./.paths)
|
||||||
|
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
|
||||||
|
fi
|
||||||
if [ -z "$(ls ./.paths)" ]; then
|
if [ -z "$(ls ./.paths)" ]; then
|
||||||
sudo rmdir ./.paths
|
sudo rmdir ./.paths
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue