_existdir
The
_existdir built-in variable holds the results of the
existdir command.
The
_existdir variable is cleared when the command is executed; after execution,
_existdir can contain either of four values:
- yes
The directory exists. - no
Either the directory exists or the user does not have access rights. - error
An operating system or file error occurred while checking the file's existence. - null character
Initial state, directory existence has not been checked.
For example:
Panel |
---|
if $(_lastrc) EQ 0
echo "The command ran correctly."
else
echo "Check for error or warning messages."
end
echo ""
if <"$(_existdir)" EQ "yes">
echo "The directory exists."
end
if <"$(_existdir)" EQ "no">
echo "The directory does not exist."
end
if <"$(_existdir)" EQ "error">
echo "A file or system error occurred."
end
if <"$(_existdir)" EQ "">
echo "A command error occurred."
end
|