bash test -a ! -e
So, I'm trying to understand the following syntax which seems contradictory to me:
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 Doesn't -a and -e mean the same thing? It seems as though it were saying that $element should and should not exist at the same time. source: http://tldp.org/LDP/abs/html/ |
In this context '-a' is logical 'and' see http://tldp.org/LDP/abs/html/comparison-ops.html
Prev page there shows the old defn of '-a' is deprecated and that page is old itself ... ;) |
I did read about it, but I didn't think it was out of use. There are many deprecated arguments, syntax structures, etc. that are deprecated, but they can still be used. So I didn't know about -a meaning 'and'. Indeed, I must have missed the definition of -a as a logical "and".
Thank you. |
All times are GMT -5. The time now is 06:12 PM. |