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?

1 Answer 1

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.

1
  • I was suspecting it means all something, but not sure what is that "something". Now I am clear, thanks, Mar 31, 2019 at 19:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .