All Questions

Tagged with
Filter by
Sorted by
Tagged with
0
votes
1answer
76 views

echo strings but extra question mark was added to the output

Strange "?" got added to the filename output. SCRIPTS="/path_to_script/" SUMMER=`cat /path_to_file/summer.txt` for i in ${SUMMER}; do cat <<- EOF > $SCRIPTS/20190430_$(echo ${i})_step4.r #...
1
vote
2answers
32 views

How to echo content into a series of new file generated by cat

I would like to write a loop to generate 22 R scripts with contents generated in echo. What went wrong in this loop that I could not get the 22 files with the corresponding content? I tested echo "i ...
15
votes
7answers
5k views

Why there is such a difference in execution time of echo and cat?

Answering this question caused me to ask another question: I thought the following scripts do the same thing and the second one should be much faster, because the first one uses cat that needs to open ...
-1
votes
1answer
3k views

Why does echo <<EOF … EOF not work [duplicate]

Just wondering if anyone can explain why this works: echo `cat <<EOF {"branch":"foo","value":"bar"} EOF` but this doesn't: echo <<EOF {"branch":"foo","value":"bar"} EOF (the second ...
1
vote
1answer
351 views

Piping cat into wall (e.g. cat | wall)

Why does echo foo | wall work but cat | wall not work? In the latter case, I enter a couple lines into cat, and in theory they should pipe to wall; however, nothing happens.
33
votes
6answers
7k views

Is 'cat' a shell built-in or an external program?

When I use the type command to find out if cat is a shell built-in or an external program I get the output below: -$ type cat cat is hashed (/bin/cat) -$ Does this mean that cat is an external ...
4
votes
1answer
257 views

Why does bash replaces text from command substitution with text thereafter

I was trying to parse some nginx config λ tree sites-enabled/ sites-available/ sites-enabled/ ├── bank.cwrcoding.com.conf ├── calendar.cwrcoding.com.conf ├── cloud.cwrcoding.com.conf ├── cwrcoding....
4
votes
4answers
3k views

echo a file as a single line with \n's

I have a multi line text file that I want to echo out as a single line file where the new lines are shown as \n. Any pointers would be great.
2
votes
2answers
5k views

Difference between 'cat < file.txt' and 'echo < file.txt' [duplicate]

I have a file named file.txt which has some content say 'abcdef', when I do cat < file.txt I get the output abcdef but when I do echo < file.txt, no output is returned. Why doesn't the input ...
1
vote
1answer
2k views

echo for Print output

I want to use the echo command to show this output: 10 item in File but seems that the below command does not work: echo "$('cat file.txt | wc -l ') items in File"
0
votes
1answer
499 views

how to send data from serial port to printer?

I have a telephone system that is connected to my old Ubuntu machine and is receiving SMDR data from it. Connected to dev/lp0 is a dot matrix printer, phone system connected to /dev/ttyS0 Currently I ...
1
vote
1answer
522 views

What happens when I echo with `-e` argument?

As you can see, I have created index.php as follows: $ echo -e "<?php passthru(\$_POST[1])?>\r<?php echo 'A PHP Test ';" > index.php and then: $ cat index.php <?php echo 'A PHP Test '...
2
votes
2answers
1k views

Why the inconsistency with using cat vs. echo piped to this sed command?

Inspired by this question: sed: N command does not read single line I wanted to understand why there appears to be an inconsistency between the following 2 commands: #1. echo This command produces ...
13
votes
2answers
22k views

Unexpected results testing serial loopback using echo and cat

So I have a standard RS232 serial port that is looped back to itself by simply running a wire from Tx to Rx. I'm testing loopback by running echo and cat in two separate terminals: cat /dev/ttyS1 ...
28
votes
1answer
21k views

Append same text to many files using cat or echo?

How can I write the same content to many text files by using cat or echo in only one command? For example I want to write "hello" to file1 and file2. I tried: echo "hello" >> file1 file2 but ...