From e53263be6e650958bd350fd6755b18cccd73ef29 Mon Sep 17 00:00:00 2001
From: Peter Gerwinski <peter.gerwinski@hs-bochum.de>
Date: Mon, 28 Mar 2022 13:58:47 +0200
Subject: [PATCH] Beispiele 28.3.2022

---
 20220328/for-1.txt       |  47 +++++++++++++++++++++++++++++++++++++++
 20220328/for-2.txt       |  11 +++++++++
 20220328/if-0.txt        |  11 +++++++++
 20220328/if-1.txt        |   7 ++++++
 20220328/if-2.txt        |   5 +++++
 20220328/if-3.sh         |   5 +++++
 20220328/if-3.txt        |   9 ++++++++
 20220328/ls-2.both       |   1 +
 20220328/pipes-1.txt     |  29 ++++++++++++++++++++++++
 20220328/pipes-2.txt     |  13 +++++++++++
 20220328/test.bc         |   1 +
 20220328/test.txt.gz     | Bin 0 -> 38 bytes
 20220328/wildcards-1.txt |   6 +++++
 20220328/wildcards-2.txt |  15 +++++++++++++
 14 files changed, 160 insertions(+)
 create mode 100644 20220328/for-1.txt
 create mode 100644 20220328/for-2.txt
 create mode 100644 20220328/if-0.txt
 create mode 100644 20220328/if-1.txt
 create mode 100644 20220328/if-2.txt
 create mode 100755 20220328/if-3.sh
 create mode 100644 20220328/if-3.txt
 create mode 100644 20220328/ls-2.both
 create mode 100644 20220328/pipes-1.txt
 create mode 100644 20220328/pipes-2.txt
 create mode 100644 20220328/test.bc
 create mode 100644 20220328/test.txt.gz
 create mode 100644 20220328/wildcards-1.txt
 create mode 100644 20220328/wildcards-2.txt

diff --git a/20220328/for-1.txt b/20220328/for-1.txt
new file mode 100644
index 0000000..45ea9d9
--- /dev/null
+++ b/20220328/for-1.txt
@@ -0,0 +1,47 @@
+cassini/home/peter/bo/2022ss/bs/20220314> for x in foo bar baz; do echo $x; done
+foo
+bar
+baz
+cassini/home/peter/bo/2022ss/bs/20220314> for x in 1 2 3 4 5 6 7 8 9 10; do echo $x; done
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+cassini/home/peter/bo/2022ss/bs/20220314> for x in $(seq 10); do echo $x; done
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+cassini/home/peter/bo/2022ss/bs/20220314> for x in $(seq -f "%04g" 10); do echo $x; done
+0001
+0002
+0003
+0004
+0005
+0006
+0007
+0008
+0009
+0010
+cassini/home/peter/bo/2022ss/bs/20220314> for x in $(seq -f "%04g" 17 23); do echo $x; done
+0017
+0018
+0019
+0020
+0021
+0022
+0023
+cassini/home/peter/bo/2022ss/bs/20220314> echo cp -pi $(for x in $(seq -f "image-%04g.jpg" 17 23); do echo $x; done) sonstwohin/
+cp -pi image-0017.jpg image-0018.jpg image-0019.jpg image-0020.jpg image-0021.jpg image-0022.jpg image-0023.jpg sonstwohin/
diff --git a/20220328/for-2.txt b/20220328/for-2.txt
new file mode 100644
index 0000000..8bd7fa4
--- /dev/null
+++ b/20220328/for-2.txt
@@ -0,0 +1,11 @@
+cassini/home/peter/bo/2022ss/bs/20220314> for ((i = 1 ; i <= 10 ; i++)); do echo $i; done
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
diff --git a/20220328/if-0.txt b/20220328/if-0.txt
new file mode 100644
index 0000000..eebd06e
--- /dev/null
+++ b/20220328/if-0.txt
@@ -0,0 +1,11 @@
+cassini/home/peter/bo/2022ss/bs/20220314> cat test.txt
+Test
+cassini/home/peter/bo/2022ss/bs/20220314> grep Test test.txt
+Test
+cassini/home/peter/bo/2022ss/bs/20220314> grep Toast test.txt
+cassini/home/peter/bo/2022ss/bs/20220314> echo $?
+1
+cassini/home/peter/bo/2022ss/bs/20220314> grep Test test.txt
+Test
+cassini/home/peter/bo/2022ss/bs/20220314> echo $?
+0
diff --git a/20220328/if-1.txt b/20220328/if-1.txt
new file mode 100644
index 0000000..5db8031
--- /dev/null
+++ b/20220328/if-1.txt
@@ -0,0 +1,7 @@
+cassini/home/peter/bo/2022ss/bs/20220314> if grep Test test.txt; then echo "gefunden"; else echo "nicht gefunden"; fi
+Test
+gefunden
+cassini/home/peter/bo/2022ss/bs/20220314> if grep Test test.txt > /dev/null; then echo "gefunden"; else echo "nicht gefunden"; fi
+gefunden
+cassini/home/peter/bo/2022ss/bs/20220314> if grep -q Test test.txt; then echo "gefunden"; else echo "nicht gefunden"; fi
+gefunden
diff --git a/20220328/if-2.txt b/20220328/if-2.txt
new file mode 100644
index 0000000..60732c3
--- /dev/null
+++ b/20220328/if-2.txt
@@ -0,0 +1,5 @@
+cassini/home/peter/bo/2022ss/bs/20220314> if grep -q Test test.txt
+> then echo "gefunden"
+> else echo "nicht gefunden"
+> fi
+gefunden
diff --git a/20220328/if-3.sh b/20220328/if-3.sh
new file mode 100755
index 0000000..07c22ca
--- /dev/null
+++ b/20220328/if-3.sh
@@ -0,0 +1,5 @@
+if grep -q Test test.txt; then
+  echo "gefunden"
+else
+  echo "nicht gefunden"
+fi
diff --git a/20220328/if-3.txt b/20220328/if-3.txt
new file mode 100644
index 0000000..a58fbc1
--- /dev/null
+++ b/20220328/if-3.txt
@@ -0,0 +1,9 @@
+cassini/home/peter/bo/2022ss/bs/20220314> cat if-3.sh
+if grep -q Test test.txt; then
+  echo "gefunden"
+else
+  echo "nicht gefunden"
+fi
+cassini/home/peter/bo/2022ss/bs/20220314> chmod +x if-3.sh
+cassini/home/peter/bo/2022ss/bs/20220314> ./if-3.sh
+gefunden
diff --git a/20220328/ls-2.both b/20220328/ls-2.both
new file mode 100644
index 0000000..0fc4e8b
--- /dev/null
+++ b/20220328/ls-2.both
@@ -0,0 +1 @@
+-rw-r--r-- 1 peter peter 20 Mär 28 13:14 test.txt
diff --git a/20220328/pipes-1.txt b/20220328/pipes-1.txt
new file mode 100644
index 0000000..a31f603
--- /dev/null
+++ b/20220328/pipes-1.txt
@@ -0,0 +1,29 @@
+cassini/home/peter/bo/2022ss/bs/20220328> cat test.bc
+1 + 1
+cassini/home/peter/bo/2022ss/bs/20220328> bc < test.bc
+2
+cassini/home/peter/bo/2022ss/bs/20220328> echo "2 + 2" | bc
+4
+cassini/home/peter/bo/2022ss/bs/20220328> cat test.txt
+Test
+Noch ein Test.
+cassini/home/peter/bo/2022ss/bs/20220328> cat test.txt | sed -e 's/Test/Toast/g'
+Toast
+Noch ein Toast.
+cassini/home/peter/bo/2022ss/bs/20220328> cat test.txt | gzip
+gzip: compressed data not written to a terminal. Use -f to force compression.
+For help, type: gzip -h
+cassini/home/peter/bo/2022ss/bs/20220328> cat test.txt | gzip -f
+7�Ab
+    I-.���O�PH����s�d-cassini/home/peter/bo/2022ss/bs/20220328> cat test.txt | gzip | gunzip
+Test
+Noch ein Test.
+cassini/home/peter/bo/2022ss/bs/20220328> cat test.txt | gzip | cat | gunzip
+Test
+Noch ein Test.
+cassini/home/peter/bo/2022ss/bs/20220328> cat test.txt | gzip > test.txt.gz
+cassini/home/peter/bo/2022ss/bs/20220328> cat test.txt.gz
+w�Ab
+    I-.���O�PH����s�d-cassini/home/peter/bo/2022ss/bs/20220328> cat test.txt.gz | gunzip
+Test
+Noch ein Test.
diff --git a/20220328/pipes-2.txt b/20220328/pipes-2.txt
new file mode 100644
index 0000000..6e5f761
--- /dev/null
+++ b/20220328/pipes-2.txt
@@ -0,0 +1,13 @@
+cassini/home/peter/bo/2022ss/bs/20220314> ls *.pdf
+bs-20220314.pdf                      logo-hochschule-bochum.pdf         unix-20220314.pdf
+logo-hochschule-bochum-cvh-text.pdf  Operating_system_placement-de.pdf
+cassini/home/peter/bo/2022ss/bs/20220314> ls *.pdf | grep -v logo
+bs-20220314.pdf
+Operating_system_placement-de.pdf
+unix-20220314.pdf
+cassini/home/peter/bo/2022ss/bs/20220314> echo $(ls *.pdf | grep -v logo)
+bs-20220314.pdf Operating_system_placement-de.pdf unix-20220314.pdf
+cassini/home/peter/bo/2022ss/bs/20220314> ls -l $(ls *.pdf | grep -v logo)
+-rw-r--r-- 1 peter peter 132739 Mär 13 22:24 bs-20220314.pdf
+lrwxrwxrwx 1 peter peter     43 Apr 17  2016 Operating_system_placement-de.pdf -> ../common/Operating_system_placement-de.pdf
+-rw-r--r-- 1 peter peter 149583 Mär 21 15:16 unix-20220314.pdf
diff --git a/20220328/test.bc b/20220328/test.bc
new file mode 100644
index 0000000..8d2f097
--- /dev/null
+++ b/20220328/test.bc
@@ -0,0 +1 @@
+1 + 1
diff --git a/20220328/test.txt.gz b/20220328/test.txt.gz
new file mode 100644
index 0000000000000000000000000000000000000000..4f6dd25dc60cbf979be117a062a21f9e19a48d78
GIT binary patch
literal 38
ucmb2|=3pqF>zKsA%<ZYG_wdtc|8oHzXU_z4Fn;>7gQ56wimnI)0|NjINe%q~

literal 0
HcmV?d00001

diff --git a/20220328/wildcards-1.txt b/20220328/wildcards-1.txt
new file mode 100644
index 0000000..b07312e
--- /dev/null
+++ b/20220328/wildcards-1.txt
@@ -0,0 +1,6 @@
+cassini/home/peter/bo/2022ss/bs/20220314> ls *.txt
+for-1.txt  if-0.txt  if-2.txt  pipes-2.txt  test.txt
+for-2.txt  if-1.txt  if-3.txt  test-2.txt
+cassini/home/peter/bo/2022ss/bs/20220314> echo mv -i {for,if,pipes}-*.txt ../20220321/
+mv -i for-1.txt for-2.txt if-0.txt if-1.txt if-2.txt if-3.txt pipes-2.txt ../20220321/
+cassini/home/peter/bo/2022ss/bs/20220314> mv -i {for,if,pipes}-*.txt ../20220321/
diff --git a/20220328/wildcards-2.txt b/20220328/wildcards-2.txt
new file mode 100644
index 0000000..d941463
--- /dev/null
+++ b/20220328/wildcards-2.txt
@@ -0,0 +1,15 @@
+cassini/home/peter/bo/2022ss/bs/20220321> ls *.txt
+for-1.txt  if-0.txt  if-2.txt  pipes-2.txt  test-2.txt  test-4.txt
+for-2.txt  if-1.txt  if-3.txt  test-1.txt   test-3.txt  wildcards-1.txt
+cassini/home/peter/bo/2022ss/bs/20220321> ls *.txt | grep -v test
+for-1.txt
+for-2.txt
+if-0.txt
+if-1.txt
+if-2.txt
+if-3.txt
+pipes-2.txt
+wildcards-1.txt
+cassini/home/peter/bo/2022ss/bs/20220321> echo mv $(ls *.txt | grep -v test) ../20220328/
+mv for-1.txt for-2.txt if-0.txt if-1.txt if-2.txt if-3.txt pipes-2.txt wildcards-1.txt ../20220328/
+cassini/home/peter/bo/2022ss/bs/20220321> mv $(ls *.txt | grep -v test) ../20220328/
-- 
GitLab