From owner-freebsd-bugs Tue Sep 19 17:20:03 1995 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id RAA09328 for bugs-outgoing; Tue, 19 Sep 1995 17:20:03 -0700 Received: (from gnats@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id RAA09321 ; Tue, 19 Sep 1995 17:20:01 -0700 Resent-Date: Tue, 19 Sep 1995 17:20:01 -0700 Resent-Message-Id: <199509200020.RAA09321@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, scott@sabami.seaslug.org Received: from statsci.statsci.com (statsci.statsci.com [198.145.127.9]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id RAA09217 for ; Tue, 19 Sep 1995 17:13:25 -0700 Received: by statsci.statsci.com (Smail3.1.28.1 #3) id m0svCih-0005iSC; Tue, 19 Sep 95 17:08 PDT Received: (from scott@localhost) by sabami.seaslug.org (8.6.11/8.6.9) id RAA08666; Tue, 19 Sep 1995 17:12:13 -0700 Message-Id: <199509200012.RAA08666@sabami.seaslug.org> Date: Tue, 19 Sep 1995 17:12:13 -0700 From: Scott Blachowicz Reply-To: scott@sabami.seaslug.org To: FreeBSD-gnats-submit@freebsd.org Cc: scott@sabami.seaslug.org X-Send-Pr-Version: 3.2 Subject: bin/728: problem with /bin/sh quoting Sender: owner-bugs@freebsd.org Precedence: bulk >Number: 728 >Category: bin >Synopsis: /bin/sh messes up quoting when going through eval >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 19 17:20:00 PDT 1995 >Last-Modified: >Originator: Scott Blachowicz >Organization: none >Release: FreeBSD 2.0-BUILT-19950603 i386 >Environment: FreeBSD 2.0.5 from the Walnut Creek CDROM. >Description: /bin/sh has a problem with quoting in something like this sample case (distilled down from a more complicated script that I've used for years on various OSs): x2=XX n=2 t=`eval echo \\\$x$n` echo $t On everything (HPUX, SunOS, Solaris, IRIX, AIX, DEC OSF1) except FreeBSD, that produces 'XX' as output. FreeBSD gives '2' as the output. >How-To-Repeat: Put these lines in a file (e.g. "test-quoting"): #! /bin/sh x2=XX n=2 t=`eval echo \\\$x$n` echo $t Season with a little execute permission. chmod a+x test-quoting Then run ./test-quoting If it outputs "XX", then it's acting as I expect it to. If it outputs "2" then it isn't. >Fix: [WORKAROUND] If a bit of redirection is introduced for the dollar sign: d='$' t=`eval echo ${d}x$n` then it works. >Audit-Trail: >Unformatted: