5 WIP
This commit is contained in:
9
beispiele/4/archive-dir.sh
Normal file
9
beispiele/4/archive-dir.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
if [ -z "$1" ]; then
|
||||
echo usage: $0 directory
|
||||
exit
|
||||
fi
|
||||
SRCD=$1
|
||||
TGTD="/home/$USER/backups/"
|
||||
OF=home-$(date +%Y%m%d).tgz
|
||||
tar -czf $TGTD$OF $SRCD
|
5
beispiele/4/create_files_with_space.sh
Normal file
5
beispiele/4/create_files_with_space.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
for f in {1..9}; do
|
||||
touch "$f xx.txt"
|
||||
done
|
3
beispiele/4/finduser.sh
Normal file
3
beispiele/4/finduser.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
find / -user dany -print 2>/dev/null
|
24
beispiele/4/mysystem.sh
Executable file
24
beispiele/4/mysystem.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
clear
|
||||
|
||||
echo "Diese Infos werden von mysystem.sh bereitgestellt."
|
||||
echo
|
||||
|
||||
echo "Hallo, $USER"
|
||||
echo
|
||||
|
||||
echo "Heute ist der `date \"+%d.%m.%Y - %H:%M:%S\"`, dies ist Woche Nr. `date +"%V"`."
|
||||
echo
|
||||
|
||||
echo "Diese Benutzer sind im Moment verbunden:"
|
||||
w | cut -d " " -f 1 - | grep -v USER | sort -u
|
||||
echo
|
||||
|
||||
echo "Dies ist `uname -s` und wir laufen auf einem $(uname -m) Prozessor."
|
||||
echo
|
||||
|
||||
echo "Die uptime ist:"
|
||||
uptime
|
||||
|
||||
MSG="\nDas ist alles! Bye, $USER! \n\n"
|
||||
printf "${MSG}"
|
7
beispiele/4/recursive-grep-in-file.sh
Normal file
7
beispiele/4/recursive-grep-in-file.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -n $2 ]
|
||||
grep -r --include="*.$2" "$1" .
|
||||
else
|
||||
grep -r "$1" .
|
||||
fi
|
17
beispiele/4/remove-spaces.sh
Executable file
17
beispiele/4/remove-spaces.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
suf=$1
|
||||
if [ $# -gt 0 ]
|
||||
then
|
||||
for f in *.$suf; do
|
||||
bn=`basename "$f" .$suf | tr [:blank:] _`
|
||||
new=$bn.$suf
|
||||
echo "neuer Dateiname:"
|
||||
echo $new
|
||||
mv "$f" $new
|
||||
done
|
||||
else
|
||||
echo "Kein Suffix gegeben!!"
|
||||
echo "Verwendung: strip-space.sh SUFFIX"
|
||||
echo "Beende ...."
|
||||
exit 1
|
||||
fi
|
17
beispiele/4/rename-jpg.sh
Normal file
17
beispiele/4/rename-jpg.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
suf=$1
|
||||
if [ $# -gt 0 ]
|
||||
then
|
||||
for f in *.$suf; do
|
||||
bn=`basename "$f" .$suf | sed 's/IMG_//'`
|
||||
new=$bn.$suf
|
||||
echo "neuer Dateiname:"
|
||||
echo $new
|
||||
mv "$f" $new
|
||||
done
|
||||
else
|
||||
echo "Kein Suffix gegeben!!"
|
||||
echo "Verwendung: strip-space.sh SUFFIX"
|
||||
echo "Beende ...."
|
||||
exit 1
|
||||
fi
|
Reference in New Issue
Block a user