From owner-freebsd-questions@FreeBSD.ORG Mon Feb 21 02:37:38 2011 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 833BC106566B for ; Mon, 21 Feb 2011 02:37:38 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 27A658FC19 for ; Mon, 21 Feb 2011 02:37:37 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.4/8.14.4) with ESMTP id p1L2baQ2058431 for ; Sun, 20 Feb 2011 19:37:36 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.4/8.14.4/Submit) with ESMTP id p1L2baYZ058428 for ; Sun, 20 Feb 2011 19:37:36 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Sun, 20 Feb 2011 19:37:36 -0700 (MST) From: Warren Block To: questions@freebsd.org In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.6 (wonkity.com [127.0.0.1]); Sun, 20 Feb 2011 19:37:37 -0700 (MST) Cc: Subject: Re: Backtick versus $() X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Feb 2011 02:37:38 -0000 Dropped the last line of the script. Also lined up the seds to show the regex is the same in both. #!/bin/sh DESTDIR="./" COMPFILE=".cshrc" PSTR=`echo "${DESTDIR}${COMPFILE}" | sed 's%\([?:.%\\]\)%\\\1%g'` echo ${PSTR} PSTR=$(echo "${DESTDIR}${COMPFILE}" | sed 's%\([?:.%\\]\)%\\\1%g') echo ${PSTR} Also, the difference is in escapes; two more backslashes added to the backtick version make it work: PSTR=`echo "${DESTDIR}${COMPFILE}" | sed 's#\([?:.%\\]\)#\\\\\1#g'` echo ${PSTR} Still: aren't backticks and $() supposed to be equivalent?