diff --git a/02-filedir.html b/02-filedir.html index 04729cfa0..7fdf026e0 100644 --- a/02-filedir.html +++ b/02-filedir.html @@ -633,7 +633,7 @@

Show me the solution

-
+

The -l option makes ls use a long listing format, showing not only the @@ -671,7 +671,7 @@

Show me the solution

-
+

The most recently changed file is listed last when using -rt. This can be very useful for finding your most recent @@ -1020,7 +1020,7 @@

Show me the solution

-
+
  1. No: . stands for the current directory.
  2. No: / stands for the root directory.
  3. @@ -1063,7 +1063,7 @@

    Show me the solution

    -
    +
    1. No: there is a directory backup in /Users.
    2. @@ -1107,7 +1107,7 @@

      Show me the solution

      -
      +
      1. No: pwd is not the name of a directory.
      2. Yes: ls without directory argument lists files and diff --git a/03-create.html b/03-create.html index db8f6f782..e39fb0328 100644 --- a/03-create.html +++ b/03-create.html @@ -572,7 +572,7 @@

        Show me the solution

        -
        +
        1. The touch command generates a new file called my_file.txt in your current directory. You can observe this @@ -780,7 +780,7 @@

          Show me the solution

          -
          +

          BASH @@ -873,7 +873,7 @@

          Show me the solution

          -
          +
          1. No. While this would create a file with the correct name, the incorrectly named file still exists in the directory and would need to @@ -939,7 +939,7 @@

            Show me the solution

            -
            +

            We start in the /Users/jamie/data directory, and create a new folder called recombined. The second line moves @@ -1027,7 +1027,7 @@

            Show me the solution

            -
            +

            OUTPUT @@ -1122,7 +1122,7 @@

            Show me the solution

            -
            +

            If given more than one file name followed by a directory name (i.e. the destination directory must be the last argument), @@ -1204,7 +1204,7 @@

            Show me the solution

            -
            +

            The solution is 3.

            1. shows all files whose names contain zero or more @@ -1328,7 +1328,7 @@

            Show me the solution

            -
            +

            BASH @@ -1395,7 +1395,7 @@

            Show me the solution

            -
            +

            BASH @@ -1486,7 +1486,7 @@

            Show me the solution

            -
            +

            The first two sets of commands achieve this objective. The first set uses relative paths to create the top-level directory before the diff --git a/04-pipefilter.html b/04-pipefilter.html index b3dc582db..96d97827c 100644 --- a/04-pipefilter.html +++ b/04-pipefilter.html @@ -535,7 +535,7 @@

            Show me the solution

            -
            +

            The -n option specifies a numerical rather than an alphanumerical sort.

            @@ -653,7 +653,7 @@

            Show me the solution

            -
            +

            In the first example with >, the string ‘hello’ is written to testfile01.txt, but the file gets overwritten @@ -706,7 +706,7 @@

            Show me the solution

            -
            +

            Option 3 is correct. For option 1 to be correct we would only run the head command. For option 2 to be correct we would only run @@ -810,7 +810,7 @@

            Show me the solution

            -
            +

            Option 4 is the solution. The pipe character | is used to connect the output from one command to the input of another. @@ -877,7 +877,7 @@

            Show me the solution

            -
            +

            The head command extracts the first 5 lines from animals.csv. Then, the last 3 lines are extracted from the @@ -943,7 +943,7 @@

            Show me the solution

            -
            +

            BASH @@ -994,7 +994,7 @@

            Show me the solution

            -
            +

            Option 4. is the correct answer. If you have difficulty understanding why, try running the commands, or sub-sections of the pipelines (make @@ -1111,7 +1111,7 @@

            Show me the solution

            -
            +
            1. This would remove .txt files with one-character names
            2. diff --git a/05-loop.html b/05-loop.html index 0a2e6b05f..ccffab0a4 100644 --- a/05-loop.html +++ b/05-loop.html @@ -268,7 +268,7 @@


            Loops

            -

            Last updated on 2023-08-09 | +

            Last updated on 2023-11-09 | Edit this page

            @@ -398,21 +398,15 @@

            Follow the Promptecho to print the value that the variable $filename currently holds. This is not necessary for the result, but beneficial for us here to have an easier time to follow -along. Next, we will assign a file name to the variable -filename and run the head command. The first -time through the loop, $filename is -basilisk.dat. The interpreter runs the command -head on basilisk.dat and pipes the first two -lines to the tail command, which then prints the second -line of basilisk.dat. For the second iteration, -$filename becomes minotaur.dat. This time, the -shell runs head on minotaur.dat and pipes the -first two lines to the tail command, which then prints the -second line of minotaur.dat. For the third iteration, -$filename becomes unicorn.dat, so the shell -runs the head command on that file, and tail -on the output of that. Since the list was only three items, the shell -exits the for loop.

            +along. Next, we will run the head command on the file +currently referred to by \(filename. The first +time through the loop, +`\)filenameisbasilisk.dat. The interpreter runs the commandheadonbasilisk.datand pipes the first two lines to thetailcommand, which then prints the second line ofbasilisk.dat. For the second iteration,\(filename` becomes `minotaur.dat`. This time, the +shell runs `head` on `minotaur.dat` and pipes the first two lines to the +`tail` command, which then prints the second line of `minotaur.dat`. For +the third iteration, +`\)filenamebecomesunicorn.dat, so the shell runs theheadcommand on that file, andtailon the output of that. Since the list was only three items, the shell exits thefor` +loop.

            @@ -489,7 +483,7 @@

            Show me the solution

            -
            +

            BASH @@ -562,7 +556,7 @@

            Show me the solution

            -
            +

            The first code block gives the same output on each iteration through the loop. Bash expands the wildcard *.pdb within the loop @@ -637,7 +631,7 @@

            Show me the solution

            -
            +

            4 is the correct answer. * matches zero or more characters, so any file name starting with the letter c, followed by @@ -680,7 +674,7 @@

            Show me the solution

            -
            +

            4 is the correct answer. * matches zero or more characters, so a file name with zero or more characters before a letter @@ -731,7 +725,7 @@

            Show me the solution

            -
            +
            1. The text from each file in turn gets written to the alkanes.pdb file. However, the file gets overwritten on @@ -785,7 +779,7 @@

              Show me the solution

              -
              +

              3 is the correct answer. >> appends to a file, rather than overwriting it with the redirected output from a command. @@ -1194,7 +1188,7 @@

              Show me the solution

              -
              +

              The second version is the one we want to run. This prints to screen everything enclosed in the quote marks, expanding the loop variable name @@ -1245,7 +1239,7 @@

              Show me the solution

              -
              +

              We have a nested loop, i.e. contained within another loop, so for each species in the outer loop, the inner loop (the nested loop) @@ -1343,7 +1337,7 @@

              Keypoints Show me the solution

              -
              +

              The -l option makes ls use a long listing format, showing not only the @@ -944,7 +944,7 @@

              Show me the solution

              -
              +

              The most recently changed file is listed last when using -rt. This can be very useful for finding your most recent @@ -1297,7 +1297,7 @@

              Show me the solution

              -
              +
              1. No: . stands for the current directory.
              2. @@ -1345,7 +1345,7 @@

                Show me the solution

                -
                +
                1. No: there is a directory backup in @@ -1393,7 +1393,7 @@

                  Show me the solution

                  -
                  +
                  1. No: pwd is not the name of a directory.
                  2. @@ -1914,7 +1914,7 @@

                    Show me the solution

                    -
                    +
                    1. The touch command generates a new file called @@ -2125,7 +2125,7 @@

                      Show me the solution

                      -
                      +

                      BASH @@ -2221,7 +2221,7 @@

                      Show me the solution

                      -
                      +
                      1. No. While this would create a file with the correct name, the @@ -2291,7 +2291,7 @@

                        Show me the solution

                        -
                        +

                        We start in the /Users/jamie/data directory, and create a new folder called recombined. The second line moves @@ -2382,7 +2382,7 @@

                        Show me the solution

                        -
                        +

                        OUTPUT @@ -2478,7 +2478,7 @@

                        Show me the solution

                        -
                        +

                        If given more than one file name followed by a directory name (i.e. the destination directory must be the last argument), @@ -2563,7 +2563,7 @@

                        Show me the solution

                        -
                        +

                        The solution is 3.

                        1. shows all files whose names contain zero or more @@ -2687,7 +2687,7 @@

                        Show me the solution

                        -
                        +

                        BASH @@ -2754,7 +2754,7 @@

                        Show me the solution

                        -
                        +

                        BASH @@ -2845,7 +2845,7 @@

                        Show me the solution

                        -
                        +

                        The first two sets of commands achieve this objective. The first set uses relative paths to create the top-level directory before the @@ -3167,7 +3167,7 @@

                        Show me the solution

                        -
                        +

                        The -n option specifies a numerical rather than an alphanumerical sort.

                        @@ -3285,7 +3285,7 @@

                        Show me the solution

                        -
                        +

                        In the first example with >, the string ‘hello’ is written to testfile01.txt, but the file gets overwritten @@ -3340,7 +3340,7 @@

                        Show me the solution

                        -
                        +

                        Option 3 is correct. For option 1 to be correct we would only run the head command. For option 2 to be correct we would only run @@ -3448,7 +3448,7 @@

                        Show me the solution

                        -
                        +

                        Option 4 is the solution. The pipe character | is used to connect the output from one command to the input of another. @@ -3516,7 +3516,7 @@

                        Show me the solution

                        -
                        +

                        The head command extracts the first 5 lines from animals.csv. Then, the last 3 lines are extracted from the @@ -3582,7 +3582,7 @@

                        Show me the solution

                        -
                        +

                        BASH @@ -3635,7 +3635,7 @@

                        Show me the solution

                        -
                        +

                        Option 4. is the correct answer. If you have difficulty understanding why, try running the commands, or sub-sections of the pipelines (make @@ -3755,7 +3755,7 @@

                        Show me the solution

                        -
                        +
                        1. This would remove .txt files with one-character @@ -3810,7 +3810,7 @@

                          Keypoints

                          Content from Loops


                          -

                          Last updated on 2023-08-09 | +

                          Last updated on 2023-11-09 | Edit this page

                          @@ -3938,21 +3938,15 @@

                          Follow the Promptecho to print the value that the variable $filename currently holds. This is not necessary for the result, but beneficial for us here to have an easier time to follow -along. Next, we will assign a file name to the variable -filename and run the head command. The first -time through the loop, $filename is -basilisk.dat. The interpreter runs the command -head on basilisk.dat and pipes the first two -lines to the tail command, which then prints the second -line of basilisk.dat. For the second iteration, -$filename becomes minotaur.dat. This time, the -shell runs head on minotaur.dat and pipes the -first two lines to the tail command, which then prints the -second line of minotaur.dat. For the third iteration, -$filename becomes unicorn.dat, so the shell -runs the head command on that file, and tail -on the output of that. Since the list was only three items, the shell -exits the for loop.

                          +along. Next, we will run the head command on the file +currently referred to by \(filename. The first +time through the loop, +`\)filenameisbasilisk.dat. The interpreter runs the commandheadonbasilisk.datand pipes the first two lines to thetailcommand, which then prints the second line ofbasilisk.dat. For the second iteration,\(filename` becomes `minotaur.dat`. This time, the +shell runs `head` on `minotaur.dat` and pipes the first two lines to the +`tail` command, which then prints the second line of `minotaur.dat`. For +the third iteration, +`\)filenamebecomesunicorn.dat, so the shell runs theheadcommand on that file, andtailon the output of that. Since the list was only three items, the shell exits thefor` +loop.

                          @@ -4029,7 +4023,7 @@

                          Show me the solution

                          -
                          +

                          BASH @@ -4102,7 +4096,7 @@

                          Show me the solution

                          -
                          +

                          The first code block gives the same output on each iteration through the loop. Bash expands the wildcard *.pdb within the loop @@ -4179,7 +4173,7 @@

                          Show me the solution

                          -
                          +

                          4 is the correct answer. * matches zero or more characters, so any file name starting with the letter c, followed by @@ -4224,7 +4218,7 @@

                          Show me the solution

                          -
                          +

                          4 is the correct answer. * matches zero or more characters, so a file name with zero or more characters before a letter @@ -4277,7 +4271,7 @@

                          Show me the solution

                          -
                          +
                          1. The text from each file in turn gets written to the @@ -4335,7 +4329,7 @@

                            Show me the solution

                            -
                            +

                            3 is the correct answer. >> appends to a file, rather than overwriting it with the redirected output from a command. @@ -4749,7 +4743,7 @@

                            Show me the solution

                            -
                            +

                            The second version is the one we want to run. This prints to screen everything enclosed in the quote marks, expanding the loop variable name @@ -4800,7 +4794,7 @@

                            Show me the solution

                            -
                            +

                            We have a nested loop, i.e. contained within another loop, so for each species in the outer loop, the inner loop (the nested loop) diff --git a/index.html b/index.html index 94199a53b..d8881e786 100644 --- a/index.html +++ b/index.html @@ -346,7 +346,7 @@

                            Windows

                            -
                            +

                            Computers with Windows operating systems do not automatically have a Unix Shell program installed. In this lesson, we encourage you to use an @@ -373,7 +373,7 @@

                            MacOS

                            -
                            +

                            For a Mac computer running macOS Mojave or earlier releases, the default Unix Shell is Bash. For a Mac computer running macOS Catalina or @@ -401,7 +401,7 @@

                            Linux

                            -
                            +

                            The default Unix Shell for Linux operating systems is usually Bash. On most versions of Linux, it is accessible by running the Gnome diff --git a/instructor/02-filedir.html b/instructor/02-filedir.html index 731058d3f..d3d07f784 100644 --- a/instructor/02-filedir.html +++ b/instructor/02-filedir.html @@ -321,7 +321,7 @@

                            Instructor Note

                            -
                            +

                            Introducing and navigating the filesystem in the shell (covered in Navigating Files and Directories section) can be confusing. You may have both terminal and GUI file explorer open side @@ -651,7 +651,7 @@

                            Show me the solution

                            -
                            +

                            The -l option makes ls use a long listing format, showing not only the @@ -689,7 +689,7 @@

                            Show me the solution

                            -
                            +

                            The most recently changed file is listed last when using -rt. This can be very useful for finding your most recent @@ -1038,7 +1038,7 @@

                            Show me the solution

                            -
                            +
                            1. No: . stands for the current directory.
                            2. No: / stands for the root directory.
                            3. @@ -1081,7 +1081,7 @@

                              Show me the solution

                              -
                              +
                              1. No: there is a directory backup in /Users.
                              2. @@ -1125,7 +1125,7 @@

                                Show me the solution

                                -
                                +
                                1. No: pwd is not the name of a directory.
                                2. Yes: ls without directory argument lists files and diff --git a/instructor/03-create.html b/instructor/03-create.html index e76575a4e..3f14b0107 100644 --- a/instructor/03-create.html +++ b/instructor/03-create.html @@ -461,7 +461,7 @@

                                  Instructor Note

                                  -
                                  +

                                  Learners can sometimes get trapped within command-line text editors such as Vim, Emacs, or Nano. Closing the terminal emulator and opening a @@ -592,7 +592,7 @@

                                  Show me the solution

                                  -
                                  +
                                  1. The touch command generates a new file called my_file.txt in your current directory. You can observe this @@ -800,7 +800,7 @@

                                    Show me the solution

                                    -
                                    +

                                    BASH @@ -893,7 +893,7 @@

                                    Show me the solution

                                    -
                                    +
                                    1. No. While this would create a file with the correct name, the incorrectly named file still exists in the directory and would need to @@ -959,7 +959,7 @@

                                      Show me the solution

                                      -
                                      +

                                      We start in the /Users/jamie/data directory, and create a new folder called recombined. The second line moves @@ -1047,7 +1047,7 @@

                                      Show me the solution

                                      -
                                      +

                                      OUTPUT @@ -1142,7 +1142,7 @@

                                      Show me the solution

                                      -
                                      +

                                      If given more than one file name followed by a directory name (i.e. the destination directory must be the last argument), @@ -1224,7 +1224,7 @@

                                      Show me the solution

                                      -
                                      +

                                      The solution is 3.

                                      1. shows all files whose names contain zero or more @@ -1348,7 +1348,7 @@

                                      Show me the solution

                                      -
                                      +

                                      BASH @@ -1415,7 +1415,7 @@

                                      Show me the solution

                                      -
                                      +

                                      BASH @@ -1506,7 +1506,7 @@

                                      Show me the solution

                                      -
                                      +

                                      The first two sets of commands achieve this objective. The first set uses relative paths to create the top-level directory before the diff --git a/instructor/04-pipefilter.html b/instructor/04-pipefilter.html index cfc1aba8d..af95dee29 100644 --- a/instructor/04-pipefilter.html +++ b/instructor/04-pipefilter.html @@ -536,7 +536,7 @@

                                      Show me the solution

                                      -
                                      +

                                      The -n option specifies a numerical rather than an alphanumerical sort.

                                      @@ -654,7 +654,7 @@

                                      Show me the solution

                                      -
                                      +

                                      In the first example with >, the string ‘hello’ is written to testfile01.txt, but the file gets overwritten @@ -707,7 +707,7 @@

                                      Show me the solution

                                      -
                                      +

                                      Option 3 is correct. For option 1 to be correct we would only run the head command. For option 2 to be correct we would only run @@ -811,7 +811,7 @@

                                      Show me the solution

                                      -
                                      +

                                      Option 4 is the solution. The pipe character | is used to connect the output from one command to the input of another. @@ -878,7 +878,7 @@

                                      Show me the solution

                                      -
                                      +

                                      The head command extracts the first 5 lines from animals.csv. Then, the last 3 lines are extracted from the @@ -944,7 +944,7 @@

                                      Show me the solution

                                      -
                                      +

                                      BASH @@ -995,7 +995,7 @@

                                      Show me the solution

                                      -
                                      +

                                      Option 4. is the correct answer. If you have difficulty understanding why, try running the commands, or sub-sections of the pipelines (make @@ -1112,7 +1112,7 @@

                                      Show me the solution

                                      -
                                      +
                                      1. This would remove .txt files with one-character names
                                      2. diff --git a/instructor/05-loop.html b/instructor/05-loop.html index 0ce864876..af38e5d1a 100644 --- a/instructor/05-loop.html +++ b/instructor/05-loop.html @@ -267,7 +267,7 @@


                                      Loops

                                      -

                                      Last updated on 2023-08-09 | +

                                      Last updated on 2023-11-09 | Edit this page

                                      @@ -399,21 +399,15 @@

                                      Follow the Promptecho to print the value that the variable $filename currently holds. This is not necessary for the result, but beneficial for us here to have an easier time to follow -along. Next, we will assign a file name to the variable -filename and run the head command. The first -time through the loop, $filename is -basilisk.dat. The interpreter runs the command -head on basilisk.dat and pipes the first two -lines to the tail command, which then prints the second -line of basilisk.dat. For the second iteration, -$filename becomes minotaur.dat. This time, the -shell runs head on minotaur.dat and pipes the -first two lines to the tail command, which then prints the -second line of minotaur.dat. For the third iteration, -$filename becomes unicorn.dat, so the shell -runs the head command on that file, and tail -on the output of that. Since the list was only three items, the shell -exits the for loop.

                                      +along. Next, we will run the head command on the file +currently referred to by \(filename. The first +time through the loop, +`\)filenameisbasilisk.dat. The interpreter runs the commandheadonbasilisk.datand pipes the first two lines to thetailcommand, which then prints the second line ofbasilisk.dat. For the second iteration,\(filename` becomes `minotaur.dat`. This time, the +shell runs `head` on `minotaur.dat` and pipes the first two lines to the +`tail` command, which then prints the second line of `minotaur.dat`. For +the third iteration, +`\)filenamebecomesunicorn.dat, so the shell runs theheadcommand on that file, andtailon the output of that. Since the list was only three items, the shell exits thefor` +loop.

                                      @@ -490,7 +484,7 @@

                                      Show me the solution

                                      -
                                      +

                                      BASH @@ -563,7 +557,7 @@

                                      Show me the solution

                                      -
                                      +

                                      The first code block gives the same output on each iteration through the loop. Bash expands the wildcard *.pdb within the loop @@ -638,7 +632,7 @@

                                      Show me the solution

                                      -
                                      +

                                      4 is the correct answer. * matches zero or more characters, so any file name starting with the letter c, followed by @@ -681,7 +675,7 @@

                                      Show me the solution

                                      -
                                      +

                                      4 is the correct answer. * matches zero or more characters, so a file name with zero or more characters before a letter @@ -732,7 +726,7 @@

                                      Show me the solution

                                      -
                                      +
                                      1. The text from each file in turn gets written to the alkanes.pdb file. However, the file gets overwritten on @@ -786,7 +780,7 @@

                                        Show me the solution

                                        -
                                        +

                                        3 is the correct answer. >> appends to a file, rather than overwriting it with the redirected output from a command. @@ -1195,7 +1189,7 @@

                                        Show me the solution

                                        -
                                        +

                                        The second version is the one we want to run. This prints to screen everything enclosed in the quote marks, expanding the loop variable name @@ -1246,7 +1240,7 @@

                                        Show me the solution

                                        -
                                        +

                                        We have a nested loop, i.e. contained within another loop, so for each species in the outer loop, the inner loop (the nested loop) @@ -1344,7 +1338,7 @@

                                        Keypoints Instructor Note

                                        -
                                        +

                                        Introducing and navigating the filesystem in the shell (covered in Navigating Files and Directories section) can be confusing. You may have both terminal and GUI file explorer open side @@ -922,7 +922,7 @@

                                        Show me the solution

                                        -
                                        +

                                        The -l option makes ls use a long listing format, showing not only the @@ -960,7 +960,7 @@

                                        Show me the solution

                                        -
                                        +

                                        The most recently changed file is listed last when using -rt. This can be very useful for finding your most recent @@ -1313,7 +1313,7 @@

                                        Show me the solution

                                        -
                                        +
                                        1. No: . stands for the current directory.
                                        2. @@ -1361,7 +1361,7 @@

                                          Show me the solution

                                          -
                                          +
                                          1. No: there is a directory backup in @@ -1409,7 +1409,7 @@

                                            Show me the solution

                                            -
                                            +
                                            1. No: pwd is not the name of a directory.
                                            2. @@ -1814,7 +1814,7 @@

                                              Instructor Note

                                              -
                                              +

                                              Learners can sometimes get trapped within command-line text editors such as Vim, Emacs, or Nano. Closing the terminal emulator and opening a @@ -1950,7 +1950,7 @@

                                              Show me the solution

                                              -
                                              +
                                              1. The touch command generates a new file called @@ -2161,7 +2161,7 @@

                                                Show me the solution

                                                -
                                                +

                                                BASH @@ -2257,7 +2257,7 @@

                                                Show me the solution

                                                -
                                                +
                                                1. No. While this would create a file with the correct name, the @@ -2327,7 +2327,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  We start in the /Users/jamie/data directory, and create a new folder called recombined. The second line moves @@ -2418,7 +2418,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  OUTPUT @@ -2514,7 +2514,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  If given more than one file name followed by a directory name (i.e. the destination directory must be the last argument), @@ -2599,7 +2599,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  The solution is 3.

                                                  1. shows all files whose names contain zero or more @@ -2723,7 +2723,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  BASH @@ -2790,7 +2790,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  BASH @@ -2881,7 +2881,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  The first two sets of commands achieve this objective. The first set uses relative paths to create the top-level directory before the @@ -3204,7 +3204,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  The -n option specifies a numerical rather than an alphanumerical sort.

                                                  @@ -3322,7 +3322,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  In the first example with >, the string ‘hello’ is written to testfile01.txt, but the file gets overwritten @@ -3377,7 +3377,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  Option 3 is correct. For option 1 to be correct we would only run the head command. For option 2 to be correct we would only run @@ -3485,7 +3485,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  Option 4 is the solution. The pipe character | is used to connect the output from one command to the input of another. @@ -3553,7 +3553,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  The head command extracts the first 5 lines from animals.csv. Then, the last 3 lines are extracted from the @@ -3619,7 +3619,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  BASH @@ -3672,7 +3672,7 @@

                                                  Show me the solution

                                                  -
                                                  +

                                                  Option 4. is the correct answer. If you have difficulty understanding why, try running the commands, or sub-sections of the pipelines (make @@ -3792,7 +3792,7 @@

                                                  Show me the solution

                                                  -
                                                  +
                                                  1. This would remove .txt files with one-character @@ -3847,7 +3847,7 @@

                                                    Keypoints

                                                    Content from Loops


                                                    -

                                                    Last updated on 2023-08-09 | +

                                                    Last updated on 2023-11-09 | Edit this page

                                                    Estimated time 50 minutes

                                                    @@ -3976,21 +3976,15 @@

                                                    Follow the Promptecho to print the value that the variable $filename currently holds. This is not necessary for the result, but beneficial for us here to have an easier time to follow -along. Next, we will assign a file name to the variable -filename and run the head command. The first -time through the loop, $filename is -basilisk.dat. The interpreter runs the command -head on basilisk.dat and pipes the first two -lines to the tail command, which then prints the second -line of basilisk.dat. For the second iteration, -$filename becomes minotaur.dat. This time, the -shell runs head on minotaur.dat and pipes the -first two lines to the tail command, which then prints the -second line of minotaur.dat. For the third iteration, -$filename becomes unicorn.dat, so the shell -runs the head command on that file, and tail -on the output of that. Since the list was only three items, the shell -exits the for loop.

                                                    +along. Next, we will run the head command on the file +currently referred to by \(filename. The first +time through the loop, +`\)filenameisbasilisk.dat. The interpreter runs the commandheadonbasilisk.datand pipes the first two lines to thetailcommand, which then prints the second line ofbasilisk.dat. For the second iteration,\(filename` becomes `minotaur.dat`. This time, the +shell runs `head` on `minotaur.dat` and pipes the first two lines to the +`tail` command, which then prints the second line of `minotaur.dat`. For +the third iteration, +`\)filenamebecomesunicorn.dat, so the shell runs theheadcommand on that file, andtailon the output of that. Since the list was only three items, the shell exits thefor` +loop.

                                                    @@ -4067,7 +4061,7 @@

                                                    Show me the solution

                                                    -
                                                    +

                                                    BASH @@ -4140,7 +4134,7 @@

                                                    Show me the solution

                                                    -
                                                    +

                                                    The first code block gives the same output on each iteration through the loop. Bash expands the wildcard *.pdb within the loop @@ -4217,7 +4211,7 @@

                                                    Show me the solution

                                                    -
                                                    +

                                                    4 is the correct answer. * matches zero or more characters, so any file name starting with the letter c, followed by @@ -4262,7 +4256,7 @@

                                                    Show me the solution

                                                    -
                                                    +

                                                    4 is the correct answer. * matches zero or more characters, so a file name with zero or more characters before a letter @@ -4315,7 +4309,7 @@

                                                    Show me the solution

                                                    -
                                                    +
                                                    1. The text from each file in turn gets written to the @@ -4373,7 +4367,7 @@

                                                      Show me the solution

                                                      -
                                                      +

                                                      3 is the correct answer. >> appends to a file, rather than overwriting it with the redirected output from a command. @@ -4787,7 +4781,7 @@

                                                      Show me the solution

                                                      -
                                                      +

                                                      The second version is the one we want to run. This prints to screen everything enclosed in the quote marks, expanding the loop variable name @@ -4838,7 +4832,7 @@

                                                      Show me the solution

                                                      -
                                                      +

                                                      We have a nested loop, i.e. contained within another loop, so for each species in the outer loop, the inner loop (the nested loop) diff --git a/instructor/index.html b/instructor/index.html index 008be04e0..87381c8a3 100644 --- a/instructor/index.html +++ b/instructor/index.html @@ -414,7 +414,7 @@

                                                      Windows

                                                      -
                                                      +

                                                      Computers with Windows operating systems do not automatically have a Unix Shell program installed. In this lesson, we encourage you to use an @@ -441,7 +441,7 @@

                                                      MacOS

                                                      -