|
516 | 516 | "`*` is a **wildcard**, which matches zero or more characters. Let's consider the `shell-lesson-data/exercise-data/proteins` directory: `*.pdb` matches `ethane.pdb`, `propane.pdb`, and every file that ends with '.pdb'. On the other hand, `p*.pdb` only matches `pentane.pdb` and `propane.pdb`, because the 'p' at the front only matches filenames that begin with the letter 'p'.\n",
|
517 | 517 | "`?` is also a wildcard, but it matches exactly one character. So `?ethane.pdb` would match `methane.pdb` whereas `*ethane.pdb` matches both `ethane.pdb`, and `methane.pdb`.\n",
|
518 | 518 | "Wildcards can be used in combination with each other e.g. `???ane.pdb` matches three characters followed by `ane.pdb`, giving `cubane.pdb ethane.pdb octane.pdb`.\n",
|
519 |
| - "When the shell sees a wildcard, it expands the wildcard to create a list of matching filenames *before* running the command that was asked for. As an exception, if a wildcard expression does not match any file, Bash will pass the expression as an argument to the command as it is. For example, typing `ls *.pdf` in the `proteins` directory (which contains only files with names ending with `.pdb`) results in an error message that there is no file called `*.pdf`. However, generally commands like `wc` and `ls` see the lists of file names matching these expressions, but not the wildcards themselves. It is the shell, not the other programs, that deals with expanding wildcards.\n", |
| 519 | + "When the shell sees a wildcard, it expands the wildcard to create a list of matching filenames *before* running the command that was asked for. As an exception, if a wildcard expression does not match any file, Bash will pass the expression as an argument to the command as it is. For example, typing `ls *.pdf` in the `proteins` directory (which contains only files with names ending with `.pdb`) results in an error message that there is no file called `*.pdf`. However, generally commands like `wc` and `ls` let us see the lists of file names matching these expressions, but not the wildcards themselves. It is the shell, not the other programs, that deals with expanding wildcards.\n", |
520 | 520 | "\n",
|
521 | 521 | "## List filenames matching a pattern\n",
|
522 | 522 | "When run in the `proteins` directory, which `ls` command(s) will produce this output?\n",
|
|
534 | 534 | "`````{admonition} Solution\n",
|
535 | 535 | ":class: dropdown\n",
|
536 | 536 | "\n",
|
537 |
| - "The solution is `3. \n", |
538 |
| - "`1.` shows all files whose names contain zero or more characters (`*`) followed by the letter `t`, then zero or more characters (`*`) followed by `ane.pdb`. This gives `ethane.pdb methane.pdb octane.pdb pentane.pdb`.\n", |
539 |
| - "`2.` shows all files whose names start with zero or more characters (`*`) followed by the letter `t`, then a single character (`?`), then `ne.` followed by zero or more characters (`*`). This will give us `octane.pdb` and `pentane.pdb` but doesn't match anything which ends in `thane.pdb`.\n", |
540 |
| - "`3.` fixes the problems of option 2 by matching two characters (`??`) between `t` and `ne`. This is the solution. \n", |
541 |
| - "`4.` only shows files starting with `ethane.`.\n", |
| 537 | + "The solution is 3. \n", |
| 538 | + " 1. shows all files whose names contain zero or more characters (`*`) followed by the letter `t`, then zero or more characters (`*`) followed by `ane.pdb`. This gives `ethane.pdb methane.pdb octane.pdb pentane.pdb`.\n", |
| 539 | + " 2. shows all files whose names start with zero or more characters (`*`) followed by the letter `t`, then a single character (`?`), then `ne.` followed by zero or more characters (`*`). This will give us `octane.pdb` and `pentane.pdb` but doesn't match anything which ends in `thane.pdb`.\n", |
| 540 | + " 3. fixes the problems of option 2 by matching two characters (`??`) between `t` and `ne`. This is the solution. \n", |
| 541 | + " 4. only shows files starting with `ethane.`.\n", |
542 | 542 | "`````\n",
|
543 | 543 | "\n",
|
544 | 544 | "\n",
|
|
575 | 575 | "$ cp ____ send_to_bob/all_datasets_created_on_a_23rd/\n",
|
576 | 576 | "```\n",
|
577 | 577 | "\n",
|
578 |
| - "Help Sam by filling in the blanks. The resulting directory structure should look like this\n", |
| 578 | + "Help Sam by filling in the blanks. The resulting directory structure should look like this:\n", |
579 | 579 | "```\n",
|
580 | 580 | ".\n",
|
581 | 581 | "├── 2015-10-23-calibration.txt\n",
|
|
662 | 662 | "``` bash\n",
|
663 | 663 | "mv *.dat analyzed\n",
|
664 | 664 | "```\n",
|
665 |
| - "Jamie needs to move her files `fructose.dat` and `sucrose.dat` to the `analyzed` directory. The shell will expand *.dat to match all .dat files in the current directory.The `mv` command then moves the list of .dat files to the 'analyzed' directory.\n", |
| 665 | + "Jamie needs to move her files `fructose.dat` and `sucrose.dat` to the `analyzed` directory. The shell will expand *.dat to match all .dat files in the current directory. The `mv` command then moves the list of .dat files to the 'analyzed' directory.\n", |
666 | 666 | "\n",
|
667 | 667 | "`````\n",
|
668 | 668 | "\n",
|
669 | 669 | "## Reproduce a folder structure\n",
|
670 | 670 | "You're starting a new experiment and would like to duplicate the directory structure from your previous experiment so you can add new data.\n",
|
671 |
| - "Assume that the previous experiment is in a folder called `2016-05-18`, which contains a `data` folder that in turn contains folders named `raw` and `processed` that contain data files. The goal is to copy the folder structureof the `2016-05-18` folder into a folder called `2016-05-20` so that your final directory structure looks like this:\n", |
| 671 | + "Assume that the previous experiment is in a folder called `2016-05-18`, which contains a `data` folder that, in turn, contains folders named `raw` and `processed` that contain data files. The goal is to copy the folder structure of the `2016-05-18` folder into a folder called `2016-05-20` so that your final directory structure looks like this:\n", |
672 | 672 | "\n",
|
673 | 673 | "```\n",
|
674 | 674 | "2016-05-20/\n",
|
|
725 | 725 | },
|
726 | 726 | {
|
727 | 727 | "cell_type": "code",
|
728 |
| - "execution_count": 1, |
| 728 | + "execution_count": 3, |
729 | 729 | "id": "a266ffb3-ba96-4bb0-a525-3219374363fb",
|
730 | 730 | "metadata": {
|
731 | 731 | "editable": true,
|
|
740 | 740 | {
|
741 | 741 | "data": {
|
742 | 742 | "text/html": [
|
743 |
| - "<div id=\"SCEEqnLWOTpJ\" data-shufflequestions=\"False\"\n", |
| 743 | + "<div id=\"YVphqgvdNOEb\" data-shufflequestions=\"False\"\n", |
744 | 744 | " data-shuffleanswers=\"True\"\n",
|
745 | 745 | " data-preserveresponses=\"false\"\n",
|
746 | 746 | " data-numquestions=\"1000000\"\n",
|
747 | 747 | " data-maxwidth=\"600\"\n",
|
748 | 748 | " style=\"border-radius: 10px; text-align: left\"> <style>\n",
|
749 |
| - "#SCEEqnLWOTpJ {\n", |
| 749 | + "#YVphqgvdNOEb {\n", |
750 | 750 | " --jq-multiple-choice-bg: #6f78ffff;\n",
|
751 | 751 | " --jq-mc-button-bg: #fafafa;\n",
|
752 | 752 | " --jq-mc-button-border: #e0e0e0e0;\n",
|
|
928 | 928 | {
|
929 | 929 | "data": {
|
930 | 930 | "application/javascript": [
|
931 |
| - "var questionsSCEEqnLWOTpJ=[\n", |
| 931 | + "var questionsYVphqgvdNOEb=[\n", |
932 | 932 | " {\n",
|
933 |
| - " \"question\": \"Which cmmmand is used to create a new directory in UNIX?\",\n", |
| 933 | + " \"question\": \"Which command is used to create a new directory in UNIX?\",\n", |
934 | 934 | " \"type\": \"many_choice\",\n",
|
935 | 935 | " \"answers\": [\n",
|
936 | 936 | " {\n",
|
|
971 | 971 | " },\n",
|
972 | 972 | " {\n",
|
973 | 973 | " \"answer\": \"erase\",\n",
|
974 |
| - " \"correct\": true,\n", |
| 974 | + " \"correct\": false,\n", |
975 | 975 | " \"feedback\": \"Incorrect\"\n",
|
976 | 976 | " },\n",
|
977 | 977 | " {\n",
|
|
1756 | 1756 | " Someone more knowledgeable could make this better ;-) */\n",
|
1757 | 1757 | "\n",
|
1758 | 1758 | " function try_show() {\n",
|
1759 |
| - " if(document.getElementById(\"SCEEqnLWOTpJ\")) {\n", |
1760 |
| - " show_questions(questionsSCEEqnLWOTpJ, SCEEqnLWOTpJ); \n", |
| 1759 | + " if(document.getElementById(\"YVphqgvdNOEb\")) {\n", |
| 1760 | + " show_questions(questionsYVphqgvdNOEb, YVphqgvdNOEb); \n", |
1761 | 1761 | " } else {\n",
|
1762 | 1762 | " setTimeout(try_show, 200);\n",
|
1763 | 1763 | " }\n",
|
|
1766 | 1766 | " {\n",
|
1767 | 1767 | " // console.log(element);\n",
|
1768 | 1768 | "\n",
|
1769 |
| - " //console.log(\"SCEEqnLWOTpJ\");\n", |
1770 |
| - " // console.log(document.getElementById(\"SCEEqnLWOTpJ\"));\n", |
| 1769 | + " //console.log(\"YVphqgvdNOEb\");\n", |
| 1770 | + " // console.log(document.getElementById(\"YVphqgvdNOEb\"));\n", |
1771 | 1771 | "\n",
|
1772 | 1772 | " try_show();\n",
|
1773 | 1773 | " }\n",
|
|
0 commit comments