RosettaCodeData/Task/Check-that-file-exists/UNIX-Shell/check-that-file-exists-2.sh
2023-07-01 13:44:08 -04:00

8 lines
201 B
Bash

for f in input.txt /input.txt; do
test -f "$f" && r=true || r=false
echo "$f is a regular file? $r"
done
for d in docs /docs; do
test -d "$d" && r=true || r=false
echo "$d is a directory? $r"
done