; author: CI/CD % test, first # trivial case -> "foo" echo "foo" # map -> "_foo_" echo "" # duplicated lines -> "foo\nlorem ipsum\nlorem ipsum\nbaz" echo foo echo lorem ipsum echo lorem ipsum echo baz # expand -> "foo" echo "" # sed with replacement -> "172.17.0.2" echo "8.8.8.8 via 172.17.0.1 dev eth0 src 172.17.0.2" | sed -E 's/.*src ([0-9.]+).*/\1/p' | head -n1 # 2nd column with default delimiter -> "rust is cool" echo " is cool" # 2nd column with custom delimiter -> "clojure is cool" echo " is cool" # multiple words -> "lorem foo bar ipsum" echo "lorem ipsum" # variable dependency, full -> "2 12 a 2" echo " " ; # variable dependency, we can ignore intermediate values -> "foo 12" ; printf "foo "; : ; echo "" # nested unused value -> "path: /my/pictures" echo "path: " # multiline command: no backslash -> "foo\nbar" echo "foo" echo "bar" # multiline command: with backslash -> "lorem ipsum\nno match" echo 'lorem ipsum' echo "foo" \ | grep -q "bar" \ && echo "match" \ || echo "no match" $ x: echo '2' $ x2: echo "$((x+10))" $ y: echo 'a' $ language: echo '0 rust rust-lang.org' --- --column 2 $ language2: echo '1;clojure;clojure.org' --- --column 2 --delimiter ';' $ multiword: echo 'foo bar' $ pictures_folder: echo "/my/pictures" $ map1: echo "foo" --- --map 'echo _$(cat)_' $ expand1: echo "foo" --- --expand # this should be displayed -> "hi" echo hi % test, second @ test, first @ test, third # nested used value -> "path: /my/pictures/wallpapers" echo "path: " # same command as before -> "12" : ; echo "" # the order isn't relevant -> "br" echo "" $ wallpaper_folder: echo "/wallpapers" % test, third ; this cheathsheet doesnt have any commands $ country: echo "br"