27 lines
429 B
Shell
Executable file
27 lines
429 B
Shell
Executable file
#!/bin/sh
|
|
set -e
|
|
|
|
lukko="${1:?vaaditaan lukon nimi}"
|
|
shift
|
|
|
|
case "$lukko" in
|
|
.|..|*/*)
|
|
printf '%s: virhe: lukon täytyy olla tiedostonimi: %s\n' "$(basename "$0")" "$lukko" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
kansio="$HOME/tmp/lukot/$lukko"
|
|
|
|
lukkotiedostot() {
|
|
find "$kansio" -mindepth 1
|
|
}
|
|
|
|
if [ -d "$kansio" ]
|
|
then
|
|
while [ -n "$(lukkotiedostot)" ]
|
|
do
|
|
lukkotiedostot | entr true 2>/dev/null || true
|
|
done
|
|
rmdir "$kansio" || true
|
|
fi
|