0

This works:

cat f.txt 2>&1

But this doesn't:

c="cat f.txt 2>&1" && `$c`
cat: '2>&1': No such file or directory

Why?

LPCWSTR
  • 33
  • 8
  • 1
    That's not the same command. `c="cat f.txt 2>&1"; $c` would have the same problem, and has no command substitution involved anywhere. See [BashFAQ #50](http://mywiki.wooledge.org/BashFAQ/050) – Charles Duffy Aug 04 '18 at 20:39
  • ...that said, using backticks for command substitution *does* change meaning of backslashes within, so you should use the more modern (standardized with the publication of POSIX.2 in 1991) syntax of `$( )` instead. – Charles Duffy Aug 04 '18 at 20:41

0 Answers0