New answers tagged

2

Other way is for eachfile in /mnt/thara/[^.]*


0

Or very simply.. ls -l | egrep -v "^\." or to iterate all directories showing filenames: ls -R | egrep -v "^\."


0

you can use find command like this : for file in $(find /mnt/thara/ -type f \( ! -iname ".*" \)) ; do ---something $file--- ; done`


3

The normal behavior of bash is to do not look to the hidden files when using for. But this behavior can be changed with shopt command. To enable the scanning for hidden files with "*": shopt -s dotglob To disable the scanning for hidden files with "*" (default behavior) shopt -u dotglob So try a script like this : shopt -u dotglob for eachfile in /...


1

I agree with the comment about the dotglob shell option. If it is unset, the behavior of the for loop is the one expected: utente@computer:/tmp/test$ shopt | grep dotglob dotglob off Let a, b, and c are normal files; .hidden1 and .hidden2 hidden files: utente@computer:/tmp/test$ touch a b c .hidden1 .hidden2 utente@computer:/tmp/test$ ls -al ...



Top 50 recent answers are included