0

The following code:

url="http%3A%2F%2Fstackoverflow.com%2Fsearch%3Fq%3Durldecode%2Bbash"

line=`echo -e ${url//%/\\x}`; 
echo $line;

line=$(echo -e ${url//%/\\x}); 
echo $line;

Produces:

httpx3Ax2Fx2Fstackoverflow.comx2Fsearchx3Fqx3Durldecodex2Bbash
http://stackoverflow.com/search?q=urldecode+bash

Shouldn't the `` and the $() produce the same result?

Raslanove
  • 649
  • 9
  • 16
  • 1
    Backslashes' behavior is different (they're treated identically to an unquoted context only in `$(...)`). That *should* be described behind the link... and looking through, it *is*. – Charles Duffy Apr 20 '19 at 21:16
  • 2
    I linked a different duplicate that -- while its title didn't make this clear pre-editing -- is explicitly asking about differing output from commands using the two different styles of command substitution. – Charles Duffy Apr 20 '19 at 21:18

0 Answers0