3
votes
2answers
229 views

echo string >> file does not work

I wrote the following script: for filename in `find . -name '*'.cpp | grep $IN_REGEX | grep -v $OUT_REGEX` do echo "Output file is $OUTPUT_FILE" count=`git log --pretty=format: --name-only ...
-4
votes
2answers
613 views

Redirecting the content of a file to the command “echo”

I have a file named my_file.txt whose content is just the string Hello. How could I redirect its content to the command echo? I know I have the commands less, cat, more... but I need to do it with ...
7
votes
1answer
504 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 ...
6
votes
1answer
306 views

differences between echo“”> and > command

I am new to Linux. There is something that is unclear to me. What is the difference between echo "" > logfile and > logfile ? When I run the first one, the logfile size doesn't become zero ...
3
votes
1answer
304 views

Shell script doesn't paint last line of stdout to screen without user input

I have a shell script that's happily doing all my backup process and writing progress to stderr and stdout, with one exception — the last line doesn't get written to my terminal (if I call the script ...
-1
votes
2answers
377 views

Copying a few lines from stdout to stderr - but only if stderr is different from stdout

I have a bash script "backup.sh", which prints out everything to stdout, including all the files that are transferred during backup. I'd like to make it possible to keep that full output, but when ...