help please
Edit
Here's the code from the pastebin:
d=`echo \"$1\"`
echo $d
#command run
./command 2
#expected output
"2"
help please
Edit
Here's the code from the pastebin:
d=`echo \"$1\"`
echo $d
#command run
./command 2
#expected output
"2"
I don't get it... It works for me:
$ cat -> command
d=`echo \"$1\"`
echo $d
$ chmod +x command
$ ./command 2
"2"
$
Works for me:
ruffian% cat test.sh
#!/bin/bash
d=`echo \"$1\"`
echo $d
ruffian% /bin/bash test.sh 2
"2"
Your command works for me, but you should use $()
instead of ``
.
d=$(echo \"$1\")
However, it's not necessary to use echo
in the assignment:
d=\"$1\"
However, on output, you probably want to quote your variable to preserve whitespace:
echo "$d"