I was writing some script under korn shell which suppose to loop X directory and search for the files with “prog” extension. The script is very simple
Just to clarify, where was no prog files in this directory while I executed it!!! But, the result of the script was
I was shocked!!. I tried to execute the same script under “bash" and result were the same. For some reason UNIX was thinking that I do have “prog” file in my directory, but I didn’t. Finally I found how to do it safely. Use the following piece of code
This one worked just fine.
If any one knows what is the reason for this strange behavior , please comment it