Check that file exists: Difference between revisions
Content added Content deleted
(→{{header|Ruby}}: Show the results.) |
(→{{header|UNIX Shell}}: Add a program to print the results.) |
||
Line 916: | Line 916: | ||
test -d docs |
test -d docs |
||
test -d /docs</lang> |
test -d /docs</lang> |
||
The next program runs all four checks and prints the results. |
|||
<lang 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</lang> |
|||
=={{header|Vedit macro language}}== |
=={{header|Vedit macro language}}== |