How to safely print variable's value without quotes?

May 20, 2008
11,391
99
Syracuse, NY, USA
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
 
Aug 23, 2010
636
9
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.
 
Aug 23, 2010
636
9
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;"
 
May 20, 2008
11,391
99
Syracuse, NY, USA
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
Thread starter Title Forum Replies Date
B when doing SFTP via IFTP to my secure site my users always get the finger print key prompt Support 1
C Recommend a Print program Support 1
C View Print Wrap - please break at whitespace Support 3
C VIEW PRINT /Wrap doesn't work Support 0
C VIEW PRINT - Documentation corrected - Font size Support 8
C WAD VIEW print multiple files - switches fail Support 10
D Can't print to Acrobat X Standard printer Support 6
C TC10 LIST - print with line nbrs incorrect Support 0
D Parsing an array variable to an array does not work Support 5
sully9 How to? Unexpected %DATE% CMD variable format (vs DATE /T format) in CMDebug Support 1
P Inserting string into a variable. Support 3
vefatica Setting array variable ignores leading spaces (and @execarray doesn't) Support 4
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
R Difference between TCC and CMD: variable names with hyphens Support 4
Joe Caverly Get a variable type Support 2
M How to set Path variable for non-executable file extensions in 4DOS Support 8
rps For loop internal %_for_files variable? Support 2
vefatica Array name in a variable? Support 3
nikbackm TCC 20 variable expansion bug Support 6
X How to set %_INIREAD result to variable Support 5
Charles Dye _USBS variable Support 2
BeechComer Debugger: how to set %1 variable? Support 3
Mordachai Variable followed by function constantly failing... Support 5
T Variable indirection for arrays Support 1
Mike Hall Unexpected "Variable loop" in IF condition Support 10
vefatica If there's no PATH variable ... Support 5
C Maximum length for a variable Support 8
D WAD Internal variable _cpu is undefined Support 2
fpefpe How to? Global variable set /v Support 4
I Change value of a variable while debugging Support 3
I "IF" command in a variable does not expand redirection variable name Support 0
J Variable setting regression in tcc17 ? Support 5
Jay Sage WAD Variable _LOGFILE Not Working Support 2
D Fixed Change in behavior of variable expansion between 16 and 17 Support 3
rps Fixed Using last argument variable ! Support 5
Jay Sage Brackets Around Variable Names Support 11
D Internal variable _tctabs within TCExit Support 9
vefatica WAD Nested variable expansion in PDIR's @function[*]? Support 13
J Set environment variable from stdout of command Support 3
nickles Passing a variable to a command w/o adding it to the local environment Support 7
nickles WAD Variable name gets changed within FOR loop Support 2
nikbackm FUNCTION with variable number of arguments Support 17
rfaquino WAD Apparently a bug when expanding environment variable %ProgramFiles(x86) Support 2
S WAD %_do_errors does not report errors when loop control variable type is not directory entry Support 1
B WAD environment variable in TCC.exe Support 2
Frank watch an array variable in ide/bdebugger Support 2
vefatica Conditional expressions in a variable? Support 2
CWBillow UNSET a Variable Support 7
M Updating environment variable from C++ fails erratically in version 14... Support 57
Frank problem with environment variable x86 vs. x64 Support 2

Similar threads