Date: Sun, 20 Feb 2011 19:37:36 -0700 (MST) From: Warren Block <wblock@wonkity.com> To: questions@freebsd.org Subject: Re: Backtick versus $() Message-ID: <alpine.BSF.2.00.1102201905410.58349@wonkity.com> In-Reply-To: <alpine.BSF.2.00.1102201027170.56885@wonkity.com> References: <alpine.BSF.2.00.1102201027170.56885@wonkity.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1102201905410.58349>