0

for example I wanted to have a PWD command

MY CODE:                cwd=`pwd`
OUTPUT:                 cwd=Users/myname/dev/.
WHAT I WANT OUTPUTED:   cwd=`pwd`

sorry if this is a bad explination, I have no idea how to explain it.

  • 1
    Your code doesn't output anything at all, it just changes the contents of the variable cwd -- so the question doesn't really make sense as-posed. – Charles Duffy Jan 31 '23 at 20:42
  • What do you mean by "print a one-liner"? What *exact* command do you use to print the output you get? `cwd=\`pwd\`` alone doesn't print anything at all. Can you show your exact command? – Benjamin W. Jan 31 '23 at 20:42
  • 2
    But assuming that you really want to _assign_ that exact string instead of _output_ that exact string, what you want is ```cwd='`pwd`'``` – Charles Duffy Jan 31 '23 at 20:42
  • (mind, for most real-world cases, you should generally prefer `$PWD` over the `pwd` command). – Charles Duffy Jan 31 '23 at 20:47

0 Answers0