I am reading the Advanced Bash scripting tutorial and I am in the tests section...
at the beginning it mentions that the use of "-a" is deprecated and instead we should use "-e" instead which checks if a file or folder exists.
but then in the example they have something like this:
Code:
linkchk () {
for element in $1/*; do
[ -h "$element" -a ! -e "$element" ] && echo \"$element\"
[ -d "$element" ] && linkchk $element
# Of course, '-h' tests for symbolic link, '-d' for directory.
done
}
now im little bit confused on how the test is going to come here:
Code:
[ -h "$element" -a ! -e "$element" ] && echo \"$element\"
I know that firts it checks if $element is a link, then it checks if exists and then it denies and then checks if $element exists?? wtf??
or is it that it checks whether or not it exists.... in any case why is he using "-a" anyways...? (probably to make you note that it works the same...)
Can you throw a little bit of light in here, im little lost!