In my shell script, I have the following code
echo * | tr ' ' '\n'
Here I noticed that although I used *, it skipped hidden files (. *) After that I tried to make an obvious change
echo .* | tr ' ' '\n'
This solved my problem with hidden files. But I'm just interested in this strange behavior *
Because. * is a subset *
desired output
echo * → All files, including hidden files
echo. * → All hidden files
echo [^.] * → All non-hidden files (currently echo *)
Therefore, echo * behaves like echo [^.] *
How to get a complete list of files, including hidden files, using echo. Similarly, there was an output for ls and dir, although ls -a gave the desired outputs
source
share