Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification for 'Loops' lesson in the Unix shell #991

Open
lshapiro31 opened this issue Jun 28, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@lshapiro31
Copy link

commented Jun 28, 2019

The first time I went through this lesson I was a bit confused by the rationale for the first loop at the top of the lesson. I am wondering if it might be clearer to show the field in the data files we are looking to isolate before running the loop?

So for example, after this block of text:

Suppose we have several hundred genome data files named basilisk.dat, unicorn.dat, and so on. For this example, we’ll use the creatures directory which only has two example files, but the principles can be applied to many many more files at once. We would like to print out the classification for each species, which is given on the second line of the file.

[ Here add the following command to execute before running the loop]

$ head -n 5 basilisk.dat unicorn.dat
==> basilisk.dat <==
COMMON NAME: basilisk
CLASSIFICATION: basiliscus vulgaris
UPDATED: 1745-05-02
CCCCAACGAG
GAAACAGATC

==> unicorn.dat <==
COMMON NAME: unicorn
CLASSIFICATION: equus monoceros
UPDATED: 1738-11-24
AGCCGGGTCG
CTTTACCTTA


@gcapes gcapes changed the title Lori Shapiro -- SWC-Instructor-Training -- Clarification for 'Loops' lesson in the Unix shell Clarification for 'Loops' lesson in the Unix shell Jul 8, 2019

@gcapes

This comment has been minimized.

Copy link
Contributor

commented Jul 8, 2019

Hi @lshapiro31

Is the confusion that the content of the files hasn't been shown, which means you're not sure what to expect as the output of the loop? Because the lesson does already explain that we want to print out the second line of the file. We could cat one of the files to show an example (which I think I usually do when teaching this), then move on to the rest of the explanation.

Would that address the problem?

Thanks

@mgibbswalton

This comment has been minimized.

Copy link

commented Jul 18, 2019

Yes! So I just finished demo teaching this exact lesson, and I think a cat command prior to running the loop to "know your data" would make a lot of sense. It does say "We would like to print out the classification for each species, which is given on the second line of the file", but a I do think a cat would be good to do within this context:

Change We would like to print out the classification for each species, which is given on the second line of the file.

to

We would like to print out the classification for each species, which is given on the second line of the file as shown in the command below (for the basilisk.dat file)
cat basilisk.dat
1 COMMON NAME: basilisk
2 CLASSIFICATION: basiliscus vulgaris
3 UPDATED: 1745-05-02
....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.