I have a simple bash script, simple.sh, as shown below:
#/usr/local/bin/bash for i in $1 do echo The current file is $i done
When I run it with the following argument:
./simple.sh /home/test/*
it will print and output only the first file located in the directory.
However, if I changed my simple.sh file to:
#/usr/local/bin/bash DIR=/home/test/* for i in $DIR do echo The current file is $i done
it will print files in the directory correctly. Can someone explain why the argument passed does not show the same result?
SamIAm
source share