If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):
From: Bela Lubkin <email@example.com> Subject: Re: misbehaving sed Date: Wed, 24 Oct 2001 10:13:26 GMT References: <20011024001157.A17650@jpradley.jpr.com> Jean-Pierre Radley wrote: > Consider this script: > > #!/bin/sh > AAA="/a/b/c" > BBB=`echo $AAA | /bin/sed -e 's/.*\///'` > echo ..$BBB.. > > As expected, I run this and get > ..c.. > > This is a simplified version of some commands in the .../bin/visionfs > script (which I personally would have written using 'basename' and no > pipe). > > On a customer's machine, I just installed > rs506a > sse071 > sse072c > sse073 > CSSA-2001-SCO.1 > CSSA-2001-SCO.10 > CSSA-2001-SCO.12 > CSSA-2001-SCO.17 > CSSA-2001-SCO.20 > > My script, on that machine errs and writes out: > ..c .. > > [The visionfs script barfs: > Unable to open message file: > /usr/vision/visionfs/_inst/en_US /visionfs > failing because of that trailing space introduced by the sed command.] > > NB: sed isn't changed by any of the mentioned patches, and both the > customer's machine and mine have the same libc.so.1 file out of rs506a.
The problem is not in sed. This script will produce the same failure: #!/bin/sh BBB=`echo c` echo ..$BBB.. The problem is in fact in /bin/sh, which you installed from CSSA-2001-SCO.24 (which you didn't mention). The CSSA-2001-SCO.24 version of /bin/sh, /sbin/sh and /usr/lib/scosh/utilbin/oash has a bug in its built-in "echo" command; it sees one more argument than you specified, and thus outputs an extra space (to separate the last real argument from the false one). The content of this false extra argument are always empty, so you just get an extra space. CSSA-2001-SCO.24 will be updated or replaced (I don't know what the current policy is) to fix this. >Bela<
Got something to add? Send me email.