Xref: utzoo comp.unix.xenix:6042 comp.unix.questions:13696 comp.unix.wizards:16195 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!husc6!cs.utexas.edu!uunet!visdc!jiii From: jiii@visdc.UUCP (John E Van Deusen III) Newsgroups: comp.unix.xenix,comp.unix.questions,comp.unix.wizards Subject: Re: SysV echo Message-ID: <541@visdc.UUCP> Date: 18 May 89 00:49:05 GMT References: <128@tdl.UUCP> <7170@bsu-cs.bsu.edu> <12970@ut-emx.UUCP> <536@visdc.UUCP> <17548@mimsy.UUCP> Reply-To: jiii@visdc.UUCP (John E Van Deusen III) Distribution: usa Organization: VI Software Development, Boise, Idaho Lines: 40 In article <17548@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: > suppose you are given a shell variable $foo, and need to echo it > uninterpreted? > > There is a solution (albeit ugly): > > cat << end > $foo > end For all purists who are almost certainly destined to be dragged into the SysV world kicking and screaming, let us formalize this solution as the command eucho. [eu] is from the Greek and means "good", "done easily", or "true". cat <<- *eueod $@ *eueod > but you may need to do something more. To keep echo from munching > away backslashes, you might do this: > > [ exasperation and shell humor concerning the difficulty of creating a > suitable shell variable deleted ] Actually SysV echo does not munch all backslashes, only ones it finds to its liking; echo '\f\g\h' will output \g\h. Is this unreasonable? The shell, sh(1), also has an inconsistent appetite for back slashes. foo=FOO echo \$foo => $foo echo `echo \$foo` => FOO In the second case the backslash was removed as a special treat, because the expression was contained within accents grave. -- John E Van Deusen III, PO Box 9283, Boise, ID 83707, (208) 343-1865 uunet!visdc!jiii