Hello, so I'm taking unix in one of my classes and I've been having fun, but I got stuck at this one question that I'm supposed to know how to answer but I can't wrap my head around it, I figured I'll post it here and see if someone can shed some light into what I'm doing wrong.
Here's the question (I translated it from french so maybe I got a few technical words wrong but bear with me please):
Which command line should you type to store the first line of all files in /etc that end with .conf in the /tmp/firsts file by emptying it at the start of the loop?
You will use the variable FILE for the the for loop and LINE to read the line.
This is what I did,
for FILE in /etc/*.conf; do read LINE </tmp/firsts; echo "$LINE" >"$FILE"; done
it says I have the right length and the right characters in the command so I know I just misplaced some parts of it.
Thanks.