Now this gets interesting. The script that manwithnoname posted works fine. However, if you have asterisks at the beginning of a line then my terminal session actually hangs!
Code:
#!/usr/bin/ksh
abc="***************************************************abc\n\n123***************\n456*********************\n789*******************\n"
IFS='
'
for line in `echo -e $abc`
do
echo $line
done
The only difference is that I added the following text to the beginning of the variable 'abc':
Code:
***************************************************abc\n\n
Can anyone explain why this would cause my shell session to hang? Removing that extra text causes the script to run okay. I think it's something to do with having the asterisks at the beginning of a line and the newline character. It's almost as if the script expands the asterisks to the files in the current directory and the newline character causes the shell to try and execute those files.