I have shell problem in a shell script that I can't explain. And it is getting worse, ... how longer I think about it how less I
understand.
....
#----------------------------------------------------------------
# define macro
#----------------------------------------------------------------
#
extensie()
{
# make IFS a line feed
IFS='
'
for i in `ls -1 $1`
do
echo "["$i"]"
ls "${1}/${i}"
type "${1}/${i}"
done
}
extensie $1
...
This is part of a much larger script to detemine attachment file types and it is called with the name of the directory where all
attachments are placed for (virus) scanning. Problem is that the "type" command always returns a "file not found" while the "ls"
does not. I need to set the IFS because of the many spaces used in attachment names. eg. "this a example.txt" instead of
"this_is_a_example.txt". Leaving the IFS unchanged would give breaks at every space.
Does anyone have an idea why the 'ls' finds the files and the 'type' does not? Using type on the command prompt does work.
TIA
Bert.