Subject: born shell (sh) and IFS
To: None <netbsd-users@netbsd.org>
From: John Maier <jmaier@midamerica.net>
List: netbsd-users
Date: 11/03/2003 11:49:06
I understand setting and using the IFS environmental variable, but I just
want to set it to trigger on an EOL (carriage return) and I can't quite
figure out how to do this?
I've dug the man page and it's useless and none of the tutorials I've found
address special characters.
In this example, I want to print each line of rc.conf with a 'X' at the
start and end of each line printed. Instead I get a 'X' at the start and a
'X' at the end of the text....
#!/bin/sh
IFS=`echo` # set a EOL to IFS or so I thought
export IFS
lines=`cat /etc/rc.conf`
for line in $lines ; do
echo "X"$line"X"
done
#EOF
Any ideas?
jam