You are not logged in.
The problem is simple, but I can find a solution. It's all about leading spaces.
#!/bin/bash
var=" test"
echo $var
# desired output
# > test
# actual output
# > test
I've tried everything I can think of, quotes, no quotes, escaping, double escaping, end so on, but nothing seems to work and I have yet to find any answers online, though not for lag of trying. Apparently it's not a problem people often have, and I can see why, ut regardsless I need leading spaces, for now at least, so please let me know if you know of a solution.
Best regards.
Last edited by zacariaz (2015-06-29 16:57:36)
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
You say you tried quotes, but where?
echo "$var"
should work.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
I've tried everything I can think of, quotes
Really?
$ var=" test"
$ echo "$var"
test
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
echo "$var"
Online
Well... That I didn't think of.
Thanks.
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline