What does asterisk (*) meant in Linux for-loop

1

I have this .ksh script snippet:

for type in *
do 
    cd ${DATA_HOME}/$type
    for mid in *
        do
            #doing something here
        done
done

My question: So what does the asterisk * particularly means when used in a for-loop such as the above?

user3437460

Posted 2019-03-31T18:23:02.730

Reputation: 123

Answers

2

"*" means all files in current directory. It's equivalent (at least in bash - I expect ksh is similar) to a space separated list of quoted file/directory names.

You can always check this type of thing for yourself by typing

echo *

The above script will likely have issued handling files/directories with a space in them.

davidgo

Posted 2019-03-31T18:23:02.730

Reputation: 49 152

I was suspecting it means all something, but not sure what is that "something". Now I am clear, thanks, – user3437460 – 2019-03-31T19:25:39.600