|
11 | 11 | "# Linux/Unix Command and Bash Scripting"
|
12 | 12 | ]
|
13 | 13 | },
|
| 14 | + { |
| 15 | + "cell_type": "markdown", |
| 16 | + "metadata": {}, |
| 17 | + "source": [ |
| 18 | + "## Getting Started" |
| 19 | + ] |
| 20 | + }, |
| 21 | + { |
| 22 | + "cell_type": "markdown", |
| 23 | + "metadata": {}, |
| 24 | + "source": [ |
| 25 | + "This lecture can be found on `state`.\n", |
| 26 | + "\n", |
| 27 | + "Let's all SSH into `state`.\n", |
| 28 | + "\n", |
| 29 | + "```sh\n", |
| 30 | + "ssh leunge@state.ohsu.edu\n", |
| 31 | + "```\n", |
| 32 | + "\n", |
| 33 | + "And navigate to your folder.\n", |
| 34 | + "\n", |
| 35 | + "```sh\n", |
| 36 | + "cd /home/courses/BMI565/students\n", |
| 37 | + "```" |
| 38 | + ] |
| 39 | + }, |
14 | 40 | {
|
15 | 41 | "cell_type": "markdown",
|
16 | 42 | "metadata": {
|
|
910 | 936 | "- [Bash One-Liners Explained, Part III: All about redirections](http://www.catonmat.net/blog/bash-one-liners-explained-part-three/)"
|
911 | 937 | ]
|
912 | 938 | },
|
| 939 | + { |
| 940 | + "cell_type": "markdown", |
| 941 | + "metadata": {}, |
| 942 | + "source": [ |
| 943 | + "## Exercise Break! (See below)" |
| 944 | + ] |
| 945 | + }, |
913 | 946 | {
|
914 | 947 | "cell_type": "markdown",
|
915 | 948 | "metadata": {},
|
|
1546 | 1579 | "metadata": {},
|
1547 | 1580 | "outputs": [],
|
1548 | 1581 | "source": [
|
1549 | | - "echo \"#!/usr/bin/env bash\n", |
| 1582 | + "echo '#!/usr/bin/env bash\n", |
1550 | 1583 | "\n",
|
1551 | 1584 | "head -n 1 ../README.md\n",
|
1552 | 1585 | "\n",
|
1553 | 1586 | "if [[ $? -eq 0 ]]; then\n",
|
1554 | | - " echo 'Successfully read beginning of file'; exit 0\n", |
| 1587 | + " echo \"Successfully read beginning of file\"; exit 0\n", |
1555 | 1588 | "else\n",
|
1556 | | - " echo 'Failed to read beginning of file'; exit 1\n", |
1557 | | - "fi\" > test_exit_codes.sh\n", |
| 1589 | + " echo \"Failed to read beginning of file\"; exit 1\n", |
| 1590 | + "fi' > test_exit_codes.sh\n", |
1558 | 1591 | "\n",
|
1559 | 1592 | "bash test_exit_codes.sh"
|
1560 | 1593 | ]
|
|
1783 | 1816 | "- [Unix / Linux: sftp File From One Server To Another](https://www.cyberciti.biz/faq/sftp-file-from-server-to-another-in-unix-linux/)"
|
1784 | 1817 | ]
|
1785 | 1818 | },
|
| 1819 | + { |
| 1820 | + "cell_type": "markdown", |
| 1821 | + "metadata": {}, |
| 1822 | + "source": [ |
| 1823 | + "## Exercise Break! (See below)" |
| 1824 | + ] |
| 1825 | + }, |
1786 | 1826 | {
|
1787 | 1827 | "cell_type": "markdown",
|
1788 | 1828 | "metadata": {},
|
|
2004 | 2044 | "all : file1_count.txt file2_count.txt file3_count.txt\n",
|
2005 | 2045 | "\n",
|
2006 | 2046 | "create :\n",
|
2007 | | - " echo -e \"1\\n2\\n3\\n4\\n5\\n6\" > file1.txt\n", |
2008 | | - " echo -e \"Hello, world!\" > file2.txt\n", |
2009 | | - " echo -e \"We're learning bash programming!\" > file3.txt\n", |
| 2047 | + " echo -e '1\\n2\\n3\\n4\\n5\\n6' > file1.txt\n", |
| 2048 | + " echo -e 'Hello, world!' > file2.txt\n", |
| 2049 | + " echo -e 'We're learning bash programming!' > file3.txt\n", |
2010 | 2050 | "\n",
|
2011 | 2051 | "%_count.txt : %.txt\n",
|
2012 | 2052 | " wc $< > $@\n",
|
|
2122 | 2162 | "\n",
|
2123 | 2163 | "### Exercise 2 Download Data and Chop It Up\n",
|
2124 | 2164 | "\n",
|
2125 | | - "Create a bash script to download the processed Long Beach V.A. data `processed.va.data` from the [Heart Disease Data Set](https://archive.ics.uci.edu/ml/datasets/Heart+Disease)and filter out for just subjects with Class 0 (last column). Save this subset of the data to a separate file.\n", |
| 2165 | + "Create a bash script to download the processed Long Beach V.A. data `processed.va.data` from the [Heart Disease Data Set](https://archive.ics.uci.edu/ml/datasets/Heart+Disease)and filter out for just subjects with Class 0 (last column). Save this subset of the data to a separate file.\n", |
2126 | 2166 | "\n",
|
2127 | 2167 | "The data can be found [here](https://archive.ics.uci.edu/ml/machine-learning-databases/heart-disease/).\n",
|
2128 | 2168 | "\n",
|
| 2169 | + "**Hint**: Use `wget'/`curl` to download file and `awk` to subset data.\n", |
| 2170 | + "\n", |
2129 | 2171 | "### Exercise 3 Search for Codons\n",
|
2130 | 2172 | "\n",
|
2131 | 2173 | "Using the random DNA sequence Python script from Exercise 1, generate a random sequence of DNA and count the number of times the DNA sequence \"TAA\" (a stop codon).\n",
|
2132 | 2174 | "\n",
|
| 2175 | + "**Hint**: Use `grep` to count number of occurrences. You can use the `-c` flag to `grep` to count things.\n", |
| 2176 | + "\n", |
2133 | 2177 | "**Bonus**: Simultaneously find all three stop codons: \"TAA\", \"TAG\", \"TGA\" and count them each."
|
2134 | 2178 | ]
|
2135 | 2179 | },
|
|
0 commit comments