Skip to content
Snippets Groups Projects
Commit e53263be authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Beispiele 28.3.2022

parent bc16f1f6
No related branches found
No related tags found
No related merge requests found
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/
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
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
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
cassini/home/peter/bo/2022ss/bs/20220314> if grep -q Test test.txt
> then echo "gefunden"
> else echo "nicht gefunden"
> fi
gefunden
if grep -q Test test.txt; then
echo "gefunden"
else
echo "nicht gefunden"
fi
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
-rw-r--r-- 1 peter peter 20 Mär 28 13:14 test.txt
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.
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
1 + 1
File added
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/
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/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment