trying to do the following:
echo "- - 830 "FTL MFG" -"
the "FTL MFG" should be left alone as one entry.
what am I doing wrong?
trying to do the following:
echo "- - 830 "FTL MFG" -"
the "FTL MFG" should be left alone as one entry.
what am I doing wrong?
echo "- - 830 "FTL MFG" -"
^^^^^^^^^^ ^^^^ quoted
^^^^^^^^ not quoted
echo sees two arguments: - - 830 FTL and MFG -, and prints them with a space in between. If you want an output with quotes, you need to escape them, or use single quotes to surround the string:
echo "- - 830 \"FTL MFG\" -"
echo '- - 830 "FTL MFG" -'
Double quotes " are string delimiters (and strings work differently in shells from what they do in most programming languages). Compare:
$ for a in "- - "830 FTL MFG" -"; do echo "$a"; done
- - 830
FTL
MFG -
You'll want to either escape the double quotes (so that they are interpreted as literal double quotes) or to delimit your string with ' instead.
% echo "- - 830 \"FTL MFG\" -"
- - 830 "FTL MFG" -
% echo '- - 830 "FTL MFG" -'
- - 830 "FTL MFG" -
FTL MFGends up being outside the quotes. What would you like it to output? Do you want those"to be included in the output – Stéphane Chazelas Jan 16 '18 at 16:50