Search Results

Search: Posts Made By: dexdex200
1,956
Posted By MadeInGermany
I vote for test -d "$dir"/. This fosters an...
I vote for
test -d "$dir"/.
This fosters an autofs mount or an AFS volume mount, so is as safe as an actual cd. No need for an additional test -x.
1,956
Posted By Don Cragun
You can also try: if ( cd "$dir" 2>/dev/null ) ...
You can also try:
if ( cd "$dir" 2>/dev/null )
then # do something
fi
If you want the diagnostic from cd if the cd failed, drop the redirection, or if you want a custom diagnostic add an else...
1,956
Posted By bakunin
A process can "cd" into a directory when it has...
A process can "cd" into a directory when it has execute-rights on it. Test simply if it is a directory AND if the x-bit is set for you:

if [ -d "$dir" -a -x "$dir" ] ; then
# do something...
Showing results 1 to 3 of 3

 
All times are GMT -4. The time now is 02:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy