Here is -w
option description from test
's man page :
-w FILE
FILE exists and write permission is granted
And as an example is better than a thousand words :
$ ls -ld /home/maxime/.gvfs
dr-x------ 2 maxime maxime 0 Aug 5 22:53 /home/maxime/.gvfs
$ [ -w /home/maxime/.gvfs ] && echo "is writable"
is writable
$ touch /home/maxime/.gvfs/file
touch: cannot touch `/home/maxime/.gvfs/file': No such file or directory
As you can see, the directory shouldn't be writable : only r
and x
flags are set.
But, test
says that I can write in it... First strange thing. Other one is what happens when I try to create a file in it : No such file or directory
.
By the way, I'm running the above commands as user "maxime", and I'm using dash from Ubuntu 12.04.
Well, I'm a bit lost here, anyone got an explanation ?
.gvfs
is a special file, in fact a virtual file system created by gvfs-fuse-daemon
. You should not use it directly.