From 8081a5520a441b43a8a7a73f3a90c7aacfaa8e10 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 24 Feb 2019 21:05:27 +0100 Subject: Move everything one level up --- .../howtos/en/index.html | 18 ++++++++++ .../howtos/si/index.html | 38 ++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 tasks/copy_rename_20_files_tail_env/howtos/en/index.html create mode 100644 tasks/copy_rename_20_files_tail_env/howtos/si/index.html (limited to 'tasks/copy_rename_20_files_tail_env/howtos') 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 @@ + + +

Purpose of this exercise

+

To learn how to use a few BASH commands.

+

Quick summary

+

You will use bash commands like: mv, grep, env etc.

+

Instructions

+ +

    +
  1. Log into your system and in your home folder you will find a directory called Mapa containing 20 files.
  2. +
  3. Rename all files, by replacing all minus signs with underscores using the command: "rename 's/-/_/' *".
  4. +
  5. 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"
  6. +
  7. 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".
  8. +
  9. 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".
  10. +
  11. 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)"
  12. +

+ + 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 @@ + + + + + +

Namen vaje

+

Naučite se uporabe nekaj BASH ukazov.

+

Naloga na hitro

+

Uporabljali boste BASH ukaze kot so: mv, grep, env in druge.

+

Navodila

+ +

    +
  1. Prijavite se v sistem. V domačem imeniku najdete imenik Mapa z 20 datotekami.
  2. +
  3. Preimenujete vse datoteke tako, da zamenjate minuse s podčrtaji z ukazom: "rename 's/-/_/' *".
  4. +
  5. 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"
  6. +
  7. 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".
  8. +
  9. 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".
  10. +
  11. 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)"
  12. +

+ + -- cgit v1.2.1