Linux - Bash - variable assignment with command substitution is missing the newlines [duplicate]
Clash Royale CLAN TAG#URR8PPP
This question already has an answer here:
Why does my shell script choke on whitespace or other special characters?
4 answers
I am running into a bit of an issue / quirk here:
[root@s06p5bcsmta001 elves]# TEST=$(cat -e sendlog)
[root@s06p5bcsmta001 elves]# echo $TEST | wc -l
1
[root@s06p5bcsmta001 elves]# cat sendlog | wc -l
1050
[root@s06p5bcsmta001 elves]# TEST=$(cat sendlog)
[root@s06p5bcsmta001 elves]# echo $TEST | wc -l
1
[root@s06p5bcsmta001 elves]# echo -e $TEST | wc -l
1
How do I get the contents of the text file (with n) into the variable?
linux bash variable command-substitution
marked as duplicate by Jeff Schaller, Anthony Geoghegan, George Vasiliou, Archemar, Kusalananda Feb 6 at 15:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Why does my shell script choke on whitespace or other special characters?
4 answers
I am running into a bit of an issue / quirk here:
[root@s06p5bcsmta001 elves]# TEST=$(cat -e sendlog)
[root@s06p5bcsmta001 elves]# echo $TEST | wc -l
1
[root@s06p5bcsmta001 elves]# cat sendlog | wc -l
1050
[root@s06p5bcsmta001 elves]# TEST=$(cat sendlog)
[root@s06p5bcsmta001 elves]# echo $TEST | wc -l
1
[root@s06p5bcsmta001 elves]# echo -e $TEST | wc -l
1
How do I get the contents of the text file (with n) into the variable?
linux bash variable command-substitution
marked as duplicate by Jeff Schaller, Anthony Geoghegan, George Vasiliou, Archemar, Kusalananda Feb 6 at 15:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
5
tryecho "$TEST" | wc -l
– Bodo
Feb 6 at 14:33
add a comment |
This question already has an answer here:
Why does my shell script choke on whitespace or other special characters?
4 answers
I am running into a bit of an issue / quirk here:
[root@s06p5bcsmta001 elves]# TEST=$(cat -e sendlog)
[root@s06p5bcsmta001 elves]# echo $TEST | wc -l
1
[root@s06p5bcsmta001 elves]# cat sendlog | wc -l
1050
[root@s06p5bcsmta001 elves]# TEST=$(cat sendlog)
[root@s06p5bcsmta001 elves]# echo $TEST | wc -l
1
[root@s06p5bcsmta001 elves]# echo -e $TEST | wc -l
1
How do I get the contents of the text file (with n) into the variable?
linux bash variable command-substitution
This question already has an answer here:
Why does my shell script choke on whitespace or other special characters?
4 answers
I am running into a bit of an issue / quirk here:
[root@s06p5bcsmta001 elves]# TEST=$(cat -e sendlog)
[root@s06p5bcsmta001 elves]# echo $TEST | wc -l
1
[root@s06p5bcsmta001 elves]# cat sendlog | wc -l
1050
[root@s06p5bcsmta001 elves]# TEST=$(cat sendlog)
[root@s06p5bcsmta001 elves]# echo $TEST | wc -l
1
[root@s06p5bcsmta001 elves]# echo -e $TEST | wc -l
1
How do I get the contents of the text file (with n) into the variable?
This question already has an answer here:
Why does my shell script choke on whitespace or other special characters?
4 answers
linux bash variable command-substitution
linux bash variable command-substitution
edited Feb 22 at 13:15
Rui F Ribeiro
40.7k1479137
40.7k1479137
asked Feb 6 at 14:28
rjkfsmrjkfsm
264
264
marked as duplicate by Jeff Schaller, Anthony Geoghegan, George Vasiliou, Archemar, Kusalananda Feb 6 at 15:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Jeff Schaller, Anthony Geoghegan, George Vasiliou, Archemar, Kusalananda Feb 6 at 15:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
5
tryecho "$TEST" | wc -l
– Bodo
Feb 6 at 14:33
add a comment |
5
tryecho "$TEST" | wc -l
– Bodo
Feb 6 at 14:33
5
5
try
echo "$TEST" | wc -l
– Bodo
Feb 6 at 14:33
try
echo "$TEST" | wc -l
– Bodo
Feb 6 at 14:33
add a comment |
1 Answer
1
active
oldest
votes
Yep - it was quoting...
echo "$TEST" | wc -l
1050
TY, Bodo!!
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Yep - it was quoting...
echo "$TEST" | wc -l
1050
TY, Bodo!!
add a comment |
Yep - it was quoting...
echo "$TEST" | wc -l
1050
TY, Bodo!!
add a comment |
Yep - it was quoting...
echo "$TEST" | wc -l
1050
TY, Bodo!!
Yep - it was quoting...
echo "$TEST" | wc -l
1050
TY, Bodo!!
answered Feb 6 at 14:49
rjkfsmrjkfsm
264
264
add a comment |
add a comment |
5
try
echo "$TEST" | wc -l
– Bodo
Feb 6 at 14:33