Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to safely print variable's value without quotes?

If it were in my environment it would be a file name and it would have to be quoted to use it. I would
Code:
v:\> echo "%_title"
"yy && xx"

SETDOS will help if you want to echo arbitrary text.
Code:
v:\> setdos /x-5

v:\> echo %_title
yy && xx

v:\> setdos /x+5
 
That's a hack, which only works if all I need to print is the value of a variable on a separate line and nothing else.
 
How do you do this in bash?
Code:
v:\> do x in /c abcdef ( echo %x )
a
b
c
d
e
f
 
I don't see a use case for this to begin with.
But there's multiple ways to achieve same effect in POSIX system.
Most portable is to use sed to insert EOL's between characters. Something like
echo "$str" | sed -e "s/./\\0\\n/g;"
 
I don't see a use case for this to begin with.
But there's multiple ways to achieve same effect in POSIX system.
Most portable is to use sed to insert EOL's between characters. Something like
echo "$str" | sed -e "s/./\\0\\n/g;"
It's more useful than echoing "yy && xx" and your suggestion is doesn't do much for me. What's $str?
 

Similar threads

Back
Top