In my code , there is such a part ;
Namefile=$1
for n in $Namefile*
do
echo $n
done
and just for this part's result is ;
$ sh example.sh hw1
hw1_evening_sun.txt
hw1_morning_sun.txt
hw1_out_si_wire.txt
hw1_script.sh
hw1_script2.sh
hw1_script3.sh
hw1_sun1.txt
hw1_sun2.txt
which are the files whose name starting with "hw1" , but I don't understand why $Namefile* takes these names.As far as I know * calls the the argument which the script receives.
Why does this method work like that ? Could someone explain the logic behind it ?
*expands, You must be givinghw1as it's first parameter; Otherwise thepwdat that moment would be containg files all of which starting withhw1.