How would I echo a string containing a variable, that has a lot of spaces before and after the var?
Desired output is:
| BLAH v1.2.3 |
The $v
var is fine, and contains the proper value.
Here's what I have so far:
#!/bin/bash
v=$(cat version.json)
echo '| BLAH v${v} |'
Update (see comments):
#!/bin/bash
v="$(cat version.json)"
echo "| BLAH v${v} |"
Results in:
Notice:
- how the front space shows up before the front pipe
- the pipe bumps up next to the first word
- the first 2 letters have vanished into the ether (lol)
- and (cant tell for sure where the last spaces are there) but the last pipe ended up on the next line.