0

I'm doing an assignment in my Linux class and my teacher is a fill-in so he's just going with what is given to him.

In the assignment it says to write a script using an Implicit loop to create file systems on partitions (they are the arguments) and use an Explicit loop to create a mount point under /mnt.

No where in our lectures was an Implicit or Explicit loop mentioned so I don't know what exactly he wants and I cannot contact him to ask before the assignment is due (we are given 3 days notice to complete this)

I appreciate you're help in taking the time to answer! Thanks!

closed as unclear what you're asking by gnat, amon, Simon B, Jörg W Mittag, Frank Hileman Mar 30 '18 at 18:43

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Rumor has it Google is open for questioning on bank holidays. Please tag the question with the script language concerned. There is a Python example here: en.m.wikipedia.org/wiki/For_loop – Martin Maat Mar 29 '18 at 5:23
  • 1
    “Implicit Loop” is not a well-defined term in shell programming, though many commands happen to loop over all their command line arguments, or over their STDIN input. But that depends entirely on the commands you are using. So I'm afraid we cannot help you either. – amon Mar 29 '18 at 12:07
  • The only person who knows what your assignment means by the term "implicit loop" is your teacher. You will have to ask her/him. "Implicit loop" and "explicit loop" are not well-defined terms with a widely-accepted definition. They were made up by your teacher, and the only person who can tell you what they mean is your teacher. But even if they were well-defined terms with a widely-accepted definition, we still cannot tell you whether the definition your teacher uses is the same as the widely-accepted one. The only person who knows that is your teacher. – Jörg W Mittag Mar 30 '18 at 0:06
2

Here's a good example:

Explicit loop:

for i in {1..4}; do echo "Welcome $i";done

Implicit loop:

 printf 'Welcome %d\n' {1..4}

Notice that explicit mean that you use the explicit iterator in a loop: i, while implicit you are doing a loop without using any iterator .

  • 1
    That's not precisely true. You can have an implicit loop with the keyword "for". Please check your definition. – Neil Mar 29 '18 at 7:30
  • I'll update my answer – user7294900 Mar 29 '18 at 7:38
  • @Neil, I would argue that an implicit iterator used in an "for" or "foreach" statement is still an "explicit loop" because for and foreach are themselves looping statements; whereas iterator.foreach(f) as you might find in some languages (e.g. javascript) would be an implicit loop as this is simply a call, and is expressed without use of a looping statement. – Erik Eidt Mar 29 '18 at 15:17
  • @ErikEidt I disagree. It isn't about the keywords used. It is about having full absolute control over which index is accessed when vs having no control and depending on a built-in mechanism. In explicit loops, you can skip every other record, while in implicit loops, you'd have to add inner logic to ignore odd entries. – Neil Mar 30 '18 at 6:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.