LINUX.ORG.RU

История изменений

Исправление Spoofing, (текущая версия) :

main() {
  echo делаем бесполезную работу
}

test -d "$@" || {
  echo "$@" is not a directory
  exit
}

test -a "$@/script.lock" && {
  echo $0 is already running in "$@" directory
  exit
}
> "$@/script.lock"

main "$@"

rm "$@/script.lock"

Исходная версия Spoofing, :

main() {
  echo делаем бесполезную работу
}

test -d "$@" || {
  echo "$@" is not a directory
  exit
}

test -a "$@/script.lock" {
  echo $0 is already running in "$@" directory
  exit
}
> "$@/script.lock"

main "$@"

rm "$@/script.lock"