What's wrong with this use of redirection?

Diego
#! /bin/bash
for i in {A,B,C,D,E,F,G,H,J} ; do

     echo     "$i
               $i
               $i
               $i 
               $i
               $i
               $i
               $i"
    cat > ~/Desktop/$i.txt                    
done

I want to make 9 text files, each showing me one letter repeated 8 times. e.g. A.txt should have the letter A 8 times in a column) If I run the script without the cat, it indeed shows me 8 times the A letter, then 8 times the B, C, etc. When inserting the cat statement, it doesn't work. What am I doing wrong?

Ipor Sircer

They're two independent commands.

echo something
cat > somewhere

You can use pipe to pass the stdout to stdin:

echo something | cat > somewhere

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related