diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2019-02-24 21:05:27 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2019-02-24 21:05:27 +0100 |
commit | 8081a5520a441b43a8a7a73f3a90c7aacfaa8e10 (patch) | |
tree | c7f49bd33ed19d53afc0ee9df8b2c82c200c5910 /tasks/copy_rename_20_files_tail_env/howtos | |
parent | 9963b74f777edf985540eac71b1ca095f88b8bca (diff) |
Move everything one level up
Diffstat (limited to 'tasks/copy_rename_20_files_tail_env/howtos')
-rw-r--r-- | tasks/copy_rename_20_files_tail_env/howtos/en/index.html | 18 | ||||
-rw-r--r-- | tasks/copy_rename_20_files_tail_env/howtos/si/index.html | 38 |
2 files changed, 56 insertions, 0 deletions
diff --git a/tasks/copy_rename_20_files_tail_env/howtos/en/index.html b/tasks/copy_rename_20_files_tail_env/howtos/en/index.html new file mode 100644 index 0000000..b1008cc --- /dev/null +++ b/tasks/copy_rename_20_files_tail_env/howtos/en/index.html @@ -0,0 +1,18 @@ +<html>
+<body>
+<h2>Purpose of this exercise</h2>
+ <p>To learn how to use a few BASH commands.</p>
+<h2>Quick summary</h2>
+ <p>You will use bash commands like: mv, grep, env etc.</p>
+<h2>Instructions</h2>
+
+<h2><ol>
+ <li>Log into your system and in your home folder you will find a directory called Mapa containing 20 files.</li>
+ <li>Rename all files, by replacing all minus signs with underscores using the command: "rename 's/-/_/' *".</li>
+ <li>Remove all files from /home/user/mapa/mojimenik into /home/user/novi using command: "mkdir-p /home/user/novi && mv /home/user/mapa/mojimenik/* /home/user/novi"</li>
+ <li>Write all regular files containing a string "mama" into file "mama.txt", and all errors in file "napake.txt" by using: "find . -type f | grep mama 1> mama.txt 2> napake.txt".</li>
+ <li>Inspect /var/log/syslog for 5 seconds and in case a string"zmeda" appears in syslog, write "imam ga". Also while inspecting syslog, reduce the counter by every second using a command: "for i in 5 4 3 2 1; do echo $i; echo $(sed -n "$i p" /var/log/syslog | grep zmeda > /dev/null && echo "imam ga"); sleep 1; done".</li>
+ <li>Set a variable TEST to the same value as the variable USER + the number of environmen variables not containing string "TEST" in their names, by adding ~/.bashrc to the end of the file: "export TEST=$USER" + "$(env | grep -v TEST | wc -l)"</li>
+</ol></h2>
+</body>
+</html>
diff --git a/tasks/copy_rename_20_files_tail_env/howtos/si/index.html b/tasks/copy_rename_20_files_tail_env/howtos/si/index.html new file mode 100644 index 0000000..1ce8b44 --- /dev/null +++ b/tasks/copy_rename_20_files_tail_env/howtos/si/index.html @@ -0,0 +1,38 @@ +<html>
+<body>
+
+<!--
+Prijavi se na sistem.
+V domači mapi najdeš imenik Mapa z 20 datotekami.
+ - preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji
+ - Napiši čim krajši ukaz, ki vse datoteke iz /home/user/mapa/mojimenik premakne v /home/user/novi
+ - Napiši ukaz, ki s pomočjo ukaza grep v datoteko "mama.txt" izpiše vse navadne (ne skrite) datoteke v trenutnem imeniku, ki vsebujejo niz "mama", v datoteko "napake.txt" pa izpiše vse morebitne napake (npr. to, da so nekateri objekti v trenutnem imeniku dejansko imeniki ali napačne simbolične povezave)
+ - Napiši ukaz, ki bo 5s sledil vsebini /var/log/syslog. V primeru, da se v syslogu pojavi niz "zmeda", naj program izpiše "imam ga". Poleg tega naj program med sledenjem syslog-u odšteva od 5 do 1 (vsako sekundo naj se izpiše naslednja številka.
+ - Nastavi okoljsko spremenljivko TEST, da bo imela isto vrednost kot okoljska spremenljivka USER + število okoljskih spremenljivk, ki v imenu ali vrednosti ne vsebujejo besede TEST. Primer: polz37
+-->
+<!--
+English
+Log into the system.
+in the home directory find the directory Mapa with 20 files.
+ -rename all the files in a such a manner that u replace al the minuses with an underscore
+ -write the shortest command possible to move all the files from /home/user/mapa/mojimenik to home/user/novi
+ -write a command which (with the help of the command grep) in the file "mama.txt" writes all the normal files (not hidden) in the current directory that contain the word "mama", and any mistakes to the file "napake.txt" (such as that the files are actually directories or wrong symbolic links)
+ -write a command which will follow the content of /var/log/syslog for 5s. In the case that the expresion "zmeda" appears in the syslog print out "imam ga". Also for every second of following the syslog print out the a number, counting down from 5 to 1.
+ -set the environment variable TEST, so it has the same value as the environmental variable USER + the number of invironmental variables which in their name do not contain the word TEST (example: polz37)
+-->
+<h2>Namen vaje</h2>
+ <p>Naučite se uporabe nekaj BASH ukazov.</p>
+<h2>Naloga na hitro</h2>
+ <p>Uporabljali boste BASH ukaze kot so: mv, grep, env in druge.</p>
+<h2>Navodila</h2>
+
+<h2><ol>
+ <li>Prijavite se v sistem. V domačem imeniku najdete imenik Mapa z 20 datotekami.</li>
+ <li>Preimenujete vse datoteke tako, da zamenjate minuse s podčrtaji z ukazom: "rename 's/-/_/' *".</li>
+ <li>Premaknite vse datoteke /home/user/mapa/mojimenik v /home/user/novi z ukazom: "mkdir-p /home/user/novi && mv /home/user/mapa/mojimenik/* /home/user/novi"</li>
+ <li>V datoteko "mama.txt" zapišite vse navadne datoteke v trenutnem imeniku, ki vsebujejo niz "mama", v datoteko "napake.txt" pa zapišite vse morebitne napake z ukazom: "find . -type f | grep mama 1> mama.txt 2> napake.txt".</li>
+ <li>Sledite vsebini /var/log/syslog za 5 sekund in v primeru, da se v syslogu pojavi niz "zmeda", izpišite "imam ga". Poleg tega med sledenjem syslog-u odštevajte od 5 do 1 z ukazom: "for i in 5 4 3 2 1; do echo $i; echo $(sed -n "$i p" /var/log/syslog | grep zmeda > /dev/null && echo "imam ga"); sleep 1; done".</li>
+ <li>Nastavite okoljsko spremenljivko TEST, da bo imela isto vrednost kot okoljska spremenljivka USER + število okoljskih spremenljivk, ki v imenu ali vrednosti ne vsebujejo besede TEST tako, da na koncu datoteke ~/.bashrc dodate: "export TEST=$USER" + "$(env | grep -v TEST | wc -l)"</li>
+</ol></h2>
+</body>
+</html>
|