In this fachpraktikum you are supposed to see the basic of bash. The goal is that you know the type of problems for which it is the right tool. You will work on a command line. Despite the ancient feeling, a lot of problems can be solved much more efficiently than with a GUI.
For every command, you can find help using
man <command> (you can leave this screen by pressing
q). We also expect you to use Google whenever you encounter a problem.
Have a look at this Cheat Sheet. It contains most of the commands you will need (and quite a lot that you don't).
You can use redirects to write the output of a program into a file.
We provide you with scripts for the first two exercises (exercise1.sh/exercise2.sh) that check your results.
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 here. We urge you to commit your changes after you have successfully solved an exercise.
msft.csv on the terminal.
allTheData.csv that contains every line from every
*.csv file in the main folder.
; he used a
# to separate the columns. Fix his mistake in
allTheData.csv write it into
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
src/core. Print every line that contains the string
// Author: ETH Zurich to every
*.java file in this directory.
// Author: University of Zurich.
src/utils. Print every file in this folder that does not contain
DO NOT DELETE.
Some bash commands accept only parameters as input. But some also accept input from stdin. Have a look at Pipes. In this exercise, we will explore a few examples.
Please change to the folder
import (note the space), but not
bitcoinj in the folder src/core in a file called
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
files with dots contain a
:). Replace all the
is running if
looper is running and
is not running otherwise. Note that this process is currently not running.
looper if it is not running.
./yourScript.sh looper backGround should work.