Olli Graf
4 months ago
9 changed files with 143 additions and 3 deletions
@ -1,3 +1,13 @@ |
|||
# bash-tut |
|||
|
|||
Dateien des bash Tutorioals auf raspithek.de |
|||
Dateien des bash Tutorioals auf raspithek.de |
|||
|
|||
| Kapitel| Beschreibung| |
|||
|--------|-------------| |
|||
1 |Einführung | |
|||
| 2 |Hello World | |
|||
| 3 | exit Codes | |
|||
| 4 |Variablen | |
|||
| 5 |Verzweigungen| |
|||
| 6 |Svhleifen | |
|||
|
|||
|
@ -0,0 +1,23 @@ |
|||
#!/usr/bin/bash |
|||
|
|||
export ANSI_FG_BLACK="\e[0;30m" |
|||
export ANSI_FG_RED="\e[0;31m" |
|||
export ANSI_FG_GREEN="\e[0;32m" |
|||
export ANSI_FG_YELLOW="\e[0;33m" |
|||
export ANSI_FG_BLUE="\e[0;34m" |
|||
export ANSI_FG_PURPLE="\e[0;35m" |
|||
export ANSI_FG_CYAN="\e[0;36m" |
|||
export ANSI_FG_WHITE="\e[0;37m" |
|||
export ANSI_NORMAL="\e[0m" |
|||
|
|||
export ANSI_BG_BLACK="\e[40m" |
|||
export ANSI_BG_RED="\e[41m" |
|||
export ANSI_BG_GREEN="\e[42m" |
|||
export ANSI_BG_BROWN="\e[43m" |
|||
export ANSI_BG_BLUE="\e[44m" |
|||
export ANSI_BG_PURPLE="\e[45m" |
|||
export ANSI_BG_TURQUOISE="\e[46m" |
|||
export ANSI_BG_GREY="\e[47m" |
|||
|
|||
export ANSI_STYLE_BOLD="\e[1;37m" |
|||
export ANSI_STYLE_UNDERLINE="\e[4;37m" |
@ -0,0 +1,26 @@ |
|||
#!/usr/bin/bash |
|||
|
|||
. ansi-consts.sh |
|||
echo -e "${ANSI_STYLE_UNDERLINE}Liste der ANSI Farbcodes Schriftfarbe${ANSI_NORMAL}" |
|||
echo -e "30:${ANSI_FG_BLACK}Schwarz${ANSI_NORMAL}" |
|||
echo -e "31:${ANSI_FG_RED}Rot${ANSI_NORMAL}" |
|||
echo -e "32:${ANSI_FG_GREEN}Grün${ANSI_NORMAL}" |
|||
echo -e "33:${ANSI_FG_YELLOW}Gelb${ANSI_NORMAL}" |
|||
echo -e "34:${ANSI_FG_BLUE}Blau${ANSI_NORMAL}" |
|||
echo -e "35:${ANSI_FG_PURPLE}Lila${ANSI_NORMAL}" |
|||
echo -e "36:${ANSI_FG_CYAN}hell Cyan${ANSI_NoRMAL}" |
|||
echo -e "37:${ANSI_FG_WHITE}Weiß${ANSI_NORMAL}" |
|||
|
|||
echo -e "${ANSI_STYLE_UNDERLINE}Liste der ANSI Farbcodes Schriftfarbe${ANSI_NORMAL}" |
|||
echo -e "\e[40m schwarz \e[0m" |
|||
echo -e "\e[41m rot \e[0m" |
|||
echo -e "\e[42m grün\e[0m" |
|||
echo -e "\e[43m hellbraun\e[0m" |
|||
echo -e "\e[44m blau\e[0m" |
|||
echo -e "\e[45m lila\e[0m" |
|||
echo -e "\e[46m türkis\e[0m" |
|||
echo -e "\e[47m hellgrau\e[0m" |
|||
|
|||
echo -e "${ANSI_STYLE_UNDERLINE}Liste der ANSI Codes Schrifteffekt${ANSI_NORMAL}" |
|||
echo -e "\e[1;37mFettdruck${ANSI_NORMAL}" |
|||
echo -e "\e[4;37mUnterstrichen${ANSI_NORMAL}" |
@ -1,14 +1,19 @@ |
|||
#and.sh |
|||
|
|||
counter='1' |
|||
test=1 |
|||
|
|||
echo "${counter}" |
|||
let counter=counter+1 |
|||
echo "${counter}" |
|||
let counter=counter+1 |
|||
|
|||
if [ ${counter} -eq 3 ] && [ ${counter} -gt 2 ]; then |
|||
echo "drei" |
|||
if [ ${counter} -eq 3 ] && [ ${test} -eq 2 ]; then |
|||
echo "0-drei" |
|||
fi |
|||
|
|||
if [ ${counter} -eq 3 ] && [ ${test} -eq 1 ]; then |
|||
echo "1-drei" |
|||
fi |
|||
let counter=counter+1 |
|||
echo "${counter}" |
|||
|
@ -0,0 +1,19 @@ |
|||
#not.sh |
|||
|
|||
counter='1' |
|||
test=1 |
|||
|
|||
echo "${counter}" |
|||
let counter=counter+1 |
|||
echo "${counter}" |
|||
let counter=counter+1 |
|||
|
|||
if ! [ ${counter} -eq 3 ] || [ ${test} -eq 2 ]; then |
|||
echo "0-drei" |
|||
fi |
|||
|
|||
if [ ${counter} -eq 3 ] || [ ${test} -eq 1 ]; then |
|||
echo "1-drei" |
|||
fi |
|||
let counter=counter+1 |
|||
echo "${counter}" |
@ -0,0 +1,19 @@ |
|||
#or.sh |
|||
|
|||
counter='1' |
|||
test=1 |
|||
|
|||
echo "${counter}" |
|||
let counter=counter+1 |
|||
echo "${counter}" |
|||
let counter=counter+1 |
|||
|
|||
if [ ${counter} -eq 3 ] || [ ${test} -eq 2 ]; then |
|||
echo "0-drei" |
|||
fi |
|||
|
|||
if [ ${counter} -eq 3 ] || [ ${test} -eq 1 ]; then |
|||
echo "1-drei" |
|||
fi |
|||
let counter=counter+1 |
|||
echo "${counter}" |
@ -0,0 +1,14 @@ |
|||
#forloop.sh |
|||
|
|||
#Ausgabe der ungeraden Zahlen bis 10 |
|||
for i in 1 3 5 7 9; do |
|||
echo "i=${i}" |
|||
done |
|||
|
|||
#Ausgabe aller Dateien in /etc |
|||
|
|||
for d in /etc/*; do |
|||
echo "${d}" |
|||
done |
|||
|
|||
|
@ -0,0 +1,12 @@ |
|||
# untilloop.sh |
|||
|
|||
count=1 |
|||
|
|||
until [ ${count} -eq 5 ]; do |
|||
echo "1" |
|||
echo "und" |
|||
count=$((${count} + 1)) |
|||
done |
|||
echo "aus" |
|||
|
|||
|
@ -0,0 +1,12 @@ |
|||
# whileloop.sh |
|||
|
|||
count=1 |
|||
|
|||
while [ ${count} -le 5 ]; do |
|||
echo "1" |
|||
echo "und" |
|||
count=$((${count} + 1)) |
|||
done |
|||
echo "aus" |
|||
|
|||
|
Loading…
Reference in new issue