Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!seismo!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: shell and sed conflicts (was embedded NL's in shell vars) Message-ID: <7998@mimsy.UUCP> Date: Sun, 16-Aug-87 22:10:50 EDT Article-I.D.: mimsy.7998 Posted: Sun Aug 16 22:10:50 1987 Date-Received: Mon, 17-Aug-87 04:43:20 EDT References: <228@cjsa.UUCP> <25712@sun.uucp> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 39 Keywords: sed sh shell There is no problem embedding newlines in shell variables. The problems people have experienced are with *evaluation* of shell variables that *contain* newlines. The difference is that between putting it in and pulling it out again. (Did you really just think what I think you thought? :-) ) For instance: #! /bin/sh foo='bar baz' echo $foo echo "$foo" produces bar baz bar baz because the shell's IFS (internal field separator) set includes newlines. The unquoted $foo expands to two arguments. #! /bin/sh foo='bar baz' IFS=' ' # that is space and tab echo $foo produces bar baz because newline has been removed from the shell's field separator set, so the unquoted $foo expands to a single argument. Read carefully the description of variable substitution under `man 1 sh'. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: seismo!mimsy!chris