Bash: difference between cat and echo
#!/bin/bash
# read.sh
while read -r line
do
echo $line
done < file.txt
This is file.txt:
foo:bar:baz:qux:quux
one:two:tree:four:five:six:seven
alpha:beta:gamma:delta:epsilon:zeta:eta:teta:iota:kappa:lambda:mu
the quick brown fox jumps over the lazy dog
This is what I tried in the terminal:
user@notebook:~/Desktop$ cat file.txt
foo:bar:baz:qux:quux
one:two:tree:four:five:six:seven
alpha:beta:gamma:delta:epsilon:zeta:eta:teta:iota:kappa:lambda:mu
the quick brown fox jumps over the lazy dogmuser@notebook:~/Desktop$ cat
read.sh
while read -r line
do
echo $line
done < file.txt
user@notebook:~/Desktop$ ./read.sh
foo:bar:baz:qux:quux
one:two:tree:four:five:six:seven
alpha:beta:gamma:delta:epsilon:zeta:eta:teta:iota:kappa:lambda:mu
My question is: why doesn't cat file.txt show the last end of line?
No comments:
Post a Comment