On Sun, 2007-04-01 at 09:51 +0100, Kevin Annies wrote: > I now wish to use the $NODE variable in a sed command to modify the > word 'DRIVE' in menu.lst, > I used the following command: > sed "s/DRIVE/$NODE/" /etc/install/lfsmenu.lst > > /home/TEMP/boot/grub/menu.lst
... > I used a similar command to modify the last word 'ROOT' and it works > fine. However DRIVE refuses to change and I have a suspicious feeling > its because of the brackets it's enclosed by. Actually, it's simpler than that. Remember, environment variables like $NODE are expanded by the shell *before* the command is actually run, so the command you're running is actually something like this: sed "s/DRIVE//dev/hda3//" ... All the extra '/' characters from the file paths are confusing sed. To work around it, you can actually use characters other than '/' as separators in the regex. I find '@' is a good one when dealing with file paths, as it's unlikely to ever appear in a file name. For example sed "[EMAIL PROTECTED]@$NODE@" ... should work fine, as it will end up as the perfectly valid expression: sed "[EMAIL PROTECTED]@/dev/hda3@" ... Simon.
signature.asc
Description: This is a digitally signed message part
-- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page