diff --git a/bash_course/exercisesheet/sheet.pdf b/bash_course/exercisesheet/sheet.pdf index a6d2cc7f307dc1126295644b3fb1e104fc50fcb7..741b8df951f8a30b29d5c43c4a20edc49b4e5426 100644 Binary files a/bash_course/exercisesheet/sheet.pdf and b/bash_course/exercisesheet/sheet.pdf differ diff --git a/bash_course/exercisesheet/sol.md b/bash_course/exercisesheet/sol.md index 92fc358579226e9432f64e5b225af23f2be5e4cf..414d5884e84c0a50174c5fa84d05e592142f2d26 100644 --- a/bash_course/exercisesheet/sol.md +++ b/bash_course/exercisesheet/sol.md @@ -202,7 +202,7 @@ This exercise requires you to parse strings to display them nicely. That can be #!/bin/bash curl -A 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)' -s https://www.reddit.com/r/showerthoughts.json \ - | jshon -e data -e children -a -e data -e title \ + | jq ".data.children[].data.title" \ | shuf -n 1 \ | sed 's/\\//g' \ | sed 's/^"//' \ diff --git a/bash_course/exercisesheet/sol.pdf b/bash_course/exercisesheet/sol.pdf index e4c054075ab89fed89757751b98f1f6585c13da3..2493f046cb4c91ce7df240e72c21976d944a96a4 100644 Binary files a/bash_course/exercisesheet/sol.pdf and b/bash_course/exercisesheet/sol.pdf differ diff --git a/bash_course/guide/guide.md b/bash_course/guide/guide.md index b093cdf64ff07804c7268d12d05f5a461d6c03ce..91c718e526a06c6f4db0698138e9ecc49e0b1b3f 100644 --- a/bash_course/guide/guide.md +++ b/bash_course/guide/guide.md @@ -950,19 +950,19 @@ such a daemon. # display only the first few lines of a very long text file head verylongtext.txt -**jshon** +**jq** -`jshon` is a very simple command-line json parser. It can read data in json format and return specific values. +`jq` is a very simple command-line json parser. It can read data in json format and return specific values. Its most important options are `-e` and `-a`. `-e` extracts the value of a given key from a json array or object: # Find the object with key "title" from a json object stored in the file "json" - jshon -e 'title' < 'json' + jq '.title' < 'json' The `-a` option maps all remaining options across the currently selected element. It has to be combined with other options, for example the `-e` option. # Find the names of all elements stored in the json object in file "json" - jshon -a -e 'name' < 'json' + jq '[].name' < 'json' **shuf** diff --git a/bash_course/guide/guide.pdf b/bash_course/guide/guide.pdf index 3228c88d4a3b83885304c858e0623be6d8b8bc95..8b9f4a92ed5dab24d879c3379bdebe91dad1526f 100644 Binary files a/bash_course/guide/guide.pdf and b/bash_course/guide/guide.pdf differ diff --git a/bash_course/pres/build.sh b/bash_course/pres/build.sh index c474c9fa0eb3c3884e67342db6389c83abd4c62c..84355f8e88f34018188ef8382d01475784a9d9f4 100755 --- a/bash_course/pres/build.sh +++ b/bash_course/pres/build.sh @@ -1,7 +1,4 @@ #!/bin/bash echo "Building pdf..." -pandoc -t beamer --template template.tex --listings pres.md -o pres-part.pdf --pdf-engine pdflatex \ - && pandoc -t beamer --template template.tex --listings firstslide.md -o firstslide.pdf --pdf-engine pdflatex \ - && pdfunite firstslide.pdf pres-part.pdf pres.pdf \ - && rm firstslide.pdf pres-part.pdf \ +pandoc -t beamer --template template.tex --listings pres.md -o pres.pdf --pdf-engine pdflatex \ && echo "Build successful" diff --git a/bash_course/pres/firstslide.md b/bash_course/pres/firstslide.md deleted file mode 100644 index a3d5496391bad3193728aeb5f20d0199e814b625..0000000000000000000000000000000000000000 --- a/bash_course/pres/firstslide.md +++ /dev/null @@ -1,5 +0,0 @@ -# Welcome to the Bash Workshop! - -* Please turn of your camera for the lecture part of the course, we only have 2GB of RAM on this server - -* If there are any technical problems, let me know! diff --git a/bash_course/pres/pres.md b/bash_course/pres/pres.md index c9ecdf1b0ffaf1f0f30e8d3c301dfd70cca524ff..9fae7b43501d3033cb72b96e8034f63f2a929568 100644 --- a/bash_course/pres/pres.md +++ b/bash_course/pres/pres.md @@ -1,6 +1,6 @@ --- author: -- Nicolas König +- Alexander Schoch title: Bash Workshop --- @@ -53,10 +53,10 @@ title: Bash Workshop echo Bash is awesome # Now some fun stuff: - sudo zypper update + sudo dnf update notify-send 'Update complete' feh --bg-fill 'pictures/fancy_wallpaper.jpg' - youtube-dl -o 'Video.%(ext)s' 'https://www.youtube.com/watch?v=lAIGb1lfpBw' + youtube-dl -o 'Video.%(ext)s' 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' ### What bash can do @@ -171,13 +171,13 @@ title: Bash Workshop ### Bash doesn’t only run commands * *Tilde expansion*\ - `~/files` becomes `/home/alinea/files` + `~/files` becomes `/home/alex/files` * *Variable expansion*\ `$BROWSER` becomes `Firefox` * *Arithmetic expansion*\ `$(( 1 + 4 ))` becomes `5` * *Command substitution*\ - `$( pwd )` becomes `/home/alinea/scripts` + `$( pwd )` becomes `/home/alex/scripts` * *Pathname expansion* (or *globbing*)\ `files/qui*` becomes `files/quicknotes files/quiz` @@ -187,7 +187,7 @@ title: Bash Workshop * Double quotes (") don't prevent expansion, but single quotes (') do. $ echo "$HOME" '$HOME' - /home/alinea $HOME + /home/alex $HOME * Expansion happens *before word splitting* diff --git a/bash_course/pres/pres.pdf b/bash_course/pres/pres.pdf index bdea99bb5fde218a8ee0af7173626949d93d8d96..4ddc852f698dbfbc6a053788aa6eb1b7ee7f51dc 100644 Binary files a/bash_course/pres/pres.pdf and b/bash_course/pres/pres.pdf differ diff --git a/bash_course/pres/scripts/example b/bash_course/pres/scripts/example index c9320d232395be87726c25273a66a49302c3621c..d781c30401bc460639e422cc76e6ca185782999f 100644 --- a/bash_course/pres/scripts/example +++ b/bash_course/pres/scripts/example @@ -5,8 +5,8 @@ echo Hello World echo Bash is awesome # Now some fun stuff: -sudo zypper update +sudo dnf update notify-send "Update complete" feh --bg-fill "pictures/fancy_wallpaper.jpg" -youtube-dl -o "Video.%(ext)s" "https://www.youtube.com/watch?v=lAIGb1lfpBw" +youtube-dl -o "Video.%(ext)s" "https://www.youtube.com/watch?v=dQw4w9WgXcQ"