Help with a question in one of my exercises

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Help with a question in one of my exercises
# 1  
Old 12-07-2017
Help with a question in one of my exercises

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.
# 2  
Old 12-07-2017
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

I would like to have some exercises to develop my skills

Hi , I would like to do some exercises/scripts in order to develop my skills in shell scripts, can someone pass me some links/suggestions where i can find this? Thanks a lot :) (3 Replies)
Discussion started by: prpkrk
3 Replies

2. OS X (Apple)

Text stream K&R exercises

Hello, ladies, gentlemen. First I suppose I should introduce myself. I've been poking at C since a long time ago, somewhere around 1990. (Don't misinterpret that. "Poking at C", in this statement, means that I jumped on it, studied it for anything from a day to a weekend to a finished "Hello,... (21 Replies)
Discussion started by: Jammer Six
21 Replies

3. Shell Programming and Scripting

Need ideas for practice exercises in sh

I did an assignment for sh scripting back in november, and I found it quite fun learning. I would like to retain this knowledge as I'm pretty sure it was my only scripting assignment, from now on in my programming course we won't be doing any scripting apart from the typical makefile scripts. The... (6 Replies)
Discussion started by: gcampton
6 Replies

4. Shell Programming and Scripting

Shall Scripts exercises

I have just 3 things that I really need to know the solution, please allow me to show it. any help would be nice script that backup a file. The file name to backup should be provided as input parameter, the backup file should have the same file name with the extension ".bak". If the user... (1 Reply)
Discussion started by: anything
1 Replies

5. UNIX for Dummies Questions & Answers

exercises in shell

Hi, I am a beginner at shell scripting, though I have several years of Oracle programming experience. Can anyone recommend a site where I can find some exercises on shell programming. Is there anywhere I can telnet as I dont have UNIX OS on my PC? Thanks Rohit (1 Reply)
Discussion started by: rohitv
1 Replies

6. Shell Programming and Scripting

question about wc

Hey my friend was asking me if i knew a way to cout how many different words in a file. I told him no not off hand, but i was thinking about it, and i started to wonder also. I imagine this is probably pretty simple im just missing something, I keep confusing my self with how you would compair and... (16 Replies)
Discussion started by: yodadbl07
16 Replies

7. Shell Programming and Scripting

Another Question?

This one keeps saying "unexprected end of file" i cant figure out what is wrong with it... (5 Replies)
Discussion started by: PoloRL185
5 Replies

8. UNIX for Dummies Questions & Answers

question

hi guys.. I'm just wondering, everytime I go to a unix dictionary to get the definition of things such as $ and >& i dont get results back.. could you give me any link that has these simple definitions or could you tell me what $ means? or >&? (1 Reply)
Discussion started by: hamoudiii
1 Replies

9. UNIX for Dummies Questions & Answers

Well, im getting it, but i have ONE question

Hay everyone, i would like to take this opportunity to thank all of you who helped me make the decision to get a linux distro. As a newbie, Im defininately considering buying Mandrake Linux... I went to the site and phew..... 2300 applications, i think ill have a good time. But i do have a... (5 Replies)
Discussion started by: LolapaloL
5 Replies
Login or Register to Ask a Question