/
githubmirror
/
lsof
Обзор
Документация
Войти
/
githubmirror
/
lsof
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/case-20-exit-status.bash
56 строк
926 B
Jiajie Chen
Use /usr/bin/env bash for shebang because /bin/bash is not available on FreeBSD
18 янв 2023, 19:23
18 янв 2023, 19:23
25e0eee
Код
Авторство
О чём код?
#!/usr/bin/env bash source tests/common.bash f=/tmp/lsof-${name}-$$ { # should fail if not exists $lsof $f > /dev/null s=$? case $s in 1) echo "ok: $lsof $f => 1" ;; *) echo "unexpected exit status: $s" echo " cmdline: $lsof $f" exit 1 ;; esac # should fail if no one opens the file touch $f $lsof $f > /dev/null s=$? case $s in 1) echo "ok: touch $f; $lsof $f => 1" rm $f ;; *) echo "unexpected exit status: $2" echo " cmdline: $lsof $f" rm $f exit 1 ;; esac # should succeed if some one opens the file g=/dev/null cat < /dev/zero > $g & pid=$! $lsof $g > /dev/null s=$? case $s in 0) echo "ok: lsof $g => 0" kill $pid ;; *) echo "unexpected exit status: $s" echo " cmdline: $lsof $g" kill $pid exit 1 ;; esac } > $report 2>&1