You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
543 B
Bash
28 lines
543 B
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
echo $@
|
|
if [ "$@" ]; 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)
|
|
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
|
|
sudo rmdir ./.paths
|
|
fi
|