bash, find and error message question
i'm trying to get the following search to give me the
answer and at the same time discard any error messages.
the directory is a mount point of a device in limbo.
it is showing up as mounted but it really isn't (the
device is turned off).
mtab says:
fusectl /sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0
/dev/sdc1 /mb ext4 rw,relatime 0 0
gphotofs /home/me/pics/camera fuse.gphotofs rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
(more on this mount/fuser stuff as a different question)
the directory is empty as it should be
but even a simple ls gives me the protocol error, but
at least the redirect functions as expected.
$ ls
ls: reading directory '.': Protocol error
$ ls 2>/dev/null
total 0
$ find . -type f -exec printf %.0s. {} + | wc -m
find: ‘.’: Protocol error
0
$ find . -type f -exec printf %.0s. {} + | wc -m 2>/dev/null
find: ‘.’: Protocol error
0
# at least this one does what i tell it to do...
$ find . -type f -exec printf %.0s. {} + | wc -m >/dev/null
find: ‘.’: Protocol error
even if i try to wrap it up in a command or subshell it
still gives me the error message and i don't really care.
i just want the answer to be 0 or the number of files.
i am using the above in a bash script so i don't want
any error messages coming from the script itself unless
i print them myself.
thanks! :)
songbird
Reply to: