User Tools

Site Tools


labs:bash

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
labs:bash [2016/03/03 17:58]
pbrandes created
labs:bash [2020/08/31 21:03] (current)
Line 5: Line 5:
 You can use [[http://​tldp.org/​HOWTO/​Bash-Prog-Intro-HOWTO-3.html|redirects]] to write the output of a program into a file. You can use [[http://​tldp.org/​HOWTO/​Bash-Prog-Intro-HOWTO-3.html|redirects]] to write the output of a program into a file.
  
-We provide you with a script ​for each exercise ​that checks ​your results.+We provide you with scripts ​for the first two exercises (exercise1.sh/​exercise2.sh) ​that check your results.
  
  
 ===== Exercise 1 ===== ===== Exercise 1 =====
  
-As a first task, please checkout the necessary files from your git repository. You can find it under ''​10.0.0.1:/​opt/​git/​ti2fp''​. The username is ''​git'';​ the password is ''​ti2lab''​. To avoid conflicts with your fellow students, please create a folder with the name of your nethz account. Copy the files into this directory. A short (and simple) introduction can be found [[http://​rogerdudler.github.io/​git-guide/​|here]]. We urge you to commit your changes after you have successfully solved an exercise.+As a first task, please checkout the necessary files from your git repository ​(you will have to install git first). You can find it under ''​10.0.0.1:/​opt/​git/​ti2fp''​. The username is ''​git'';​ the password is ''​ti2lab''​. To avoid conflicts with your fellow students, please create a folder with the name of your nethz account ​and copy the files into this folder. You can now create a new repository in this folder. This will allow you to undo any mistakes you make. A short (and simple) introduction can be found [[http://​rogerdudler.github.io/​git-guide/​|here]]. We urge you to commit your changes after you have successfully solved an exercise.
  
  
Line 17: Line 17:
   - Unfortunately,​ your colleague, who created these files, did not follow the standard you agreed upon. Instead of a '';''​ he used a ''#''​ to separate the columns. Fix his mistake in ''​allTheData.csv''​.   - Unfortunately,​ your colleague, who created these files, did not follow the standard you agreed upon. Instead of a '';''​ he used a ''#''​ to separate the columns. Fix his mistake in ''​allTheData.csv''​.
   - Count the number of lines in ''​allTheData.csv''​ write it into ''​numberOfLines.txt''​.   - Count the number of lines in ''​allTheData.csv''​ write it into ''​numberOfLines.txt''​.
-  - Go to the folder ''​csv-Files''​. In this folder there are dozens of csv files (in subfolders). Write the name of every ''​*.csv''​ file into ''​csvFilesList.txt''​.+  - Go to the folder ''​csv-Files''​. In this folder there are dozens of csv files (in subfolders). Write the name of every ''​*.csv''​ file (including the path starting from the folder ''​csv-Files''​) ​into ''​csvFilesList.txt''​.
   - Write the content of all these files into ''​allCSVFilesContent.txt''​.   - Write the content of all these files into ''​allCSVFilesContent.txt''​.
   - Go to the folder ''​src/​core''​. Print every line that contains the string ''​author''​ or ''​Author''​.   - Go to the folder ''​src/​core''​. Print every line that contains the string ''​author''​ or ''​Author''​.
   - Append the string ''​%%//​%% Author: ETH Zurich''​ to every ''​*.java''​ file in this directory.   - Append the string ''​%%//​%% Author: ETH Zurich''​ to every ''​*.java''​ file in this directory.
-  - Print every **file** that contains the string ''​%%//​%% Author: University of Zurich''​.+  - Print every **filename** that contains the string ''​%%//​%% Author: University of Zurich''​.
   - Delete those files.   - Delete those files.
   - Go to the folder ''​src/​utils''​. Print every file in this folder that does not contain ''​DO NOT DELETE''​.   - Go to the folder ''​src/​utils''​. Print every file in this folder that does not contain ''​DO NOT DELETE''​.
Line 38: Line 38:
   - Write every line that contains ''​import ''​ (note the space), but not ''​bitcoinj''​ in the folder src/core in a file called ''​all_the_imports.txt''​.   - Write every line that contains ''​import ''​ (note the space), but not ''​bitcoinj''​ in the folder src/core in a file called ''​all_the_imports.txt''​.
   - Count the total number of lines that contain "​import"​ in every java file in src/core and write it into ''​importLine.txt''​   - Count the total number of lines that contain "​import"​ in every java file in src/core and write it into ''​importLine.txt''​
-  - You know now how many lines there are. But you (should have) noticed that quite a few lines appear more than once. Which line appears the most? Write this line (without spaces) into ''​mostImported.txt''​.+  - You know now how many lines there are. But you (should have) noticed that quite a few lines appear more than once. Which line appears the most? Write this line (without spaces ​in the beginning) into ''​mostImported.txt''​.
   - The file ''​allSrc.txt''​ (in the folder src) contains a list of files. Write every line of these files that contain the word ''​static''​ into the file ''​static.txt''​.   - The file ''​allSrc.txt''​ (in the folder src) contains a list of files. Write every line of these files that contain the word ''​static''​ into the file ''​static.txt''​.
  
Line 50: Line 50:
   - Update your script such that it starts ''​looper''​ if it is not running.   - Update your script such that it starts ''​looper''​ if it is not running.
   - Update your script such that it continuously monitors ''​looper''​.   - Update your script such that it continuously monitors ''​looper''​.
-  - Update your script such that it accepts the names of several programs as parameter.+  - Update your script such that it accepts the names of several programs as parameter, i.e., ''​./​yourScript.sh looper backGround''​ should work.
  
  
labs/bash.1457024290.txt.gz ยท Last modified: 2020/08/31 21:03 (external edit)