5 WIP
This commit is contained in:
		
							
								
								
									
										2
									
								
								4.html
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								4.html
									
									
									
									
									
								
							| @@ -219,7 +219,7 @@ USER     Benutzername</code></pre> | ||||
| 		        </section> | ||||
|  | ||||
|  | ||||
|   				<section style="font-size: .6em"> | ||||
|   				<section style="font-size: .7em"> | ||||
| 		        	<pre><code>#!/bin/bash | ||||
| clear | ||||
| echo "Diese Infos werden von mysystem.sh bereitgestellt." | ||||
|   | ||||
							
								
								
									
										120
									
								
								5.html
									
									
									
									
									
								
							
							
						
						
									
										120
									
								
								5.html
									
									
									
									
									
								
							| @@ -40,7 +40,7 @@ | ||||
| 				<section data-transition="slide" data-background="#4d7e65" data-background-transition="zoom"> | ||||
| 					<h1>LINUX</h1> | ||||
| 					<h3>Das universelle Betriebssystem</h3> | ||||
| 					<p>Eine Einführung - Teil 4 | ||||
| 					<p>Eine Einführung - Teil 5 | ||||
| 					<p> | ||||
| 						<small>Deutsche Angestellten Akademie</small> | ||||
| 					</p> | ||||
| @@ -51,24 +51,118 @@ | ||||
| 				</section> | ||||
| 				 | ||||
| 				<section> | ||||
| 					<h2>vim und emacs</h2> | ||||
| 					<h3>Die mächtigen Unix Editoren</h3> | ||||
| 					<h2>Bash scripting - Fortsetzung</h2> | ||||
| 				</section> | ||||
|  | ||||
| 				<section data-transition="slide" data-background="#4d7e65" data-background-transition="zoom"> | ||||
| 					<h3>vim</h3> | ||||
| 				<section> | ||||
| 					<h3>LINKS</h3> | ||||
|  | ||||
| 					<p>http://tldp.org/LDP/abs/html/complexfunct.html | ||||
|  | ||||
| 					<p>http://programmingexamples.wikidot.com/bash-scripting#toc24 | ||||
|  | ||||
| 					<p>https://wiki.ubuntuusers.de/Shell/Bash-Skripting-Guide_für_Anfänger/#Quoting | ||||
|  | ||||
| 					<div> | ||||
| 					- script kontrolle ( strg-z etc ) | ||||
| 					- input  | ||||
| 					- parameter | ||||
| 					- functions | ||||
| 					 | ||||
| 					- kontrollstrukturen | ||||
| 					-  | ||||
|  | ||||
| 				</section> | ||||
|  | ||||
|  | ||||
| 				<section> | ||||
| 					<h3>Variablen</h3> | ||||
| 					<pre><code>#!/bin/bash | ||||
|   | ||||
| x=10            #NICHT x = 10 -> keine Leerzeichen! | ||||
| X=20            #variablen sind Case Sensitive | ||||
| $y=             #NULL variable | ||||
| echo "x = $x" | ||||
| echo "X = $X" | ||||
| echo "y = $y"</code></pre> | ||||
| 				</section> | ||||
|  | ||||
| 				<section> | ||||
| 					<h3>Kommentare</h3> | ||||
| 					<pre><code> | ||||
| #!/bin/bash | ||||
| # Diese Zeile ist ein Kommentar | ||||
| echo "A comment will follow." # Comment here. | ||||
| echo "The # here does not begin a comment." | ||||
| echo 'The # here does not begin a comment.' | ||||
| echo The \# here does not begin a comment. | ||||
| echo The # here begins a comment. | ||||
|   | ||||
| echo ${PATH#*:}       # Parameter substitution, not a comment. | ||||
| echo $(( 2#101011 ))  # Base conversion, not a comment. | ||||
| 					</code> | ||||
| 					</pre> | ||||
| 				</section> | ||||
|  | ||||
| 				<section> | ||||
| 					<h3>Quotes</h3> | ||||
|  | ||||
| 					<ul> | ||||
|             <li class="fragment">ein Editor für die shell </li> | ||||
|             <li class="fragment">immer da, oft in der alten Variante „vi“ </li> | ||||
|             <li class="fragment">Vi IMproved</li> | ||||
|             <li class="fragment">komplett per Kürzel steuerbar </li> | ||||
|             <li class="fragment">umfassend anpassbar </li> | ||||
|             <li class="fragment">erweiterbar </li> | ||||
|             <li class="fragment">syntax highlighting </li> | ||||
|             <li class="fragment">vim ist einfach cool ;-)</li> | ||||
| 						<li class="fragment ">Double Quotes: " " -Anything enclose in double quotes removed meaning of that characters (except \ and $).</li> | ||||
| 						<li class="fragment ">Single quotes: ' ' - Enclosed in single quotes remains unchanged.</li> | ||||
| 						<li class="fragment ">Back quote: ` ` - To execute command</li> | ||||
| 					</ul> | ||||
| 				</section> | ||||
|  | ||||
| 				<section> | ||||
| 					<h3>Input - Output redirection</h3> | ||||
|  | ||||
| <ul> | ||||
| 	<li class="fragment "> > : output in Datei. Best. Datei wird überschrieben!</li> | ||||
| 	<li class="fragment "> >> : output an Datei anhängen.</li> | ||||
| 	<li class="fragment "> < : Kommando Input aus Datei lesen</li> | ||||
| </ul> | ||||
| 						<pre><code>#!/bin/bash | ||||
| echo "ls > file_list" | ||||
| ls > file_list | ||||
|   | ||||
| echo "ls -la >> file_list" | ||||
| ls -la >> file_list | ||||
|   | ||||
| echo "cat < file_list" | ||||
| cat < file_list</code></pre> | ||||
|  | ||||
| 						 | ||||
| 				</section> | ||||
| 				<section> | ||||
| 					- arithmetik | ||||
|  | ||||
| 					let "m = 4 * 1024";echo $m | ||||
|  | ||||
| 					let "m += 15" | ||||
| 					let "m -= 3" | ||||
| 					let "m /= 5" | ||||
| 					let "m %= 10" | ||||
| 					let "m++" | ||||
| 					let "m--" | ||||
|  | ||||
| 					let "k = (m < 9) ? 0 : 1" | ||||
| 					condition ? value-if-true : value-if-false | ||||
|  | ||||
| 					Floating Poin: | ||||
| 					echo "32.0 + 1.4" | bc  | ||||
|  | ||||
| 					echo `expr $m + 18` | ||||
| 					m=`expr $m + 18` | ||||
|  | ||||
| 					(( m *= 4 )) | ||||
|  | ||||
| 				</section> | ||||
| 				<section data-transition="slide" data-background="#4d7e65" data-background-transition="zoom"> | ||||
|         | ||||
| 				</section> | ||||
|  | ||||
|  | ||||
|  | ||||
|         <section> | ||||
|           <h3>Die 5 Level eines Vim Magiers</h3> | ||||
|   | ||||
							
								
								
									
										0
									
								
								beispiele/mysystem.sh → beispiele/4/mysystem.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								beispiele/mysystem.sh → beispiele/4/mysystem.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										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 | ||||
							
								
								
									
										8
									
								
								beispiele/5/01-vars.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								beispiele/5/01-vars.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| #!/bin/bash | ||||
|   | ||||
| x=10            #NOT x = 10 no spaces | ||||
| X=20            #variables are case sensitive | ||||
| $y=             #NULL variable | ||||
| echo "x = $x" | ||||
| echo "X = $X" | ||||
| echo "y = $y" | ||||
							
								
								
									
										10
									
								
								beispiele/5/02-comments.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								beispiele/5/02-comments.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| #!/bin/bash | ||||
| # This line is a comment. | ||||
| echo "A comment will follow." # Comment here. | ||||
| echo "The # here does not begin a comment." | ||||
| echo 'The # here does not begin a comment.' | ||||
| echo The \# here does not begin a comment. | ||||
| echo The # here begins a comment. | ||||
|   | ||||
| echo ${PATH#*:}       # Parameter substitution, not a comment. | ||||
| echo $(( 2#101011 ))  # Base conversion, not a comment. | ||||
							
								
								
									
										28
									
								
								beispiele/5/recursive-func.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								beispiele/5/recursive-func.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| # Beispiel für Rekursive Funktion | ||||
|  | ||||
| #Funktions-Definition | ||||
| function sum() { | ||||
|     if [ -z "$2" ]; then | ||||
|  | ||||
|         #Rückgabewert | ||||
|         echo $1 | ||||
|  | ||||
|     else | ||||
|         a=$1; | ||||
|          | ||||
|         #Parameter werden nach links verschoben : orkus  <- $1 , $1 <- $2  | ||||
|         shift; | ||||
|          | ||||
|         #Funktion ruft sich selbst auf - Rekursion | ||||
|         #Ergebnis. b == 2 | ||||
|         b=`sum $@` | ||||
|  | ||||
|  | ||||
|         echo `expr $a + $b` # <- 1 + 2  | ||||
|     fi | ||||
| } | ||||
|  | ||||
| # Funktions-Aufruf mit 2 Parametern | ||||
| sum 1 2 | ||||
							
								
								
									
										27
									
								
								beispiele/5/while-menu.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								beispiele/5/while-menu.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| # Script to create simple menus and take action according to that selected | ||||
| # menu item | ||||
| # | ||||
| while : | ||||
|  do | ||||
|     clear | ||||
|     echo "-------------------------------------" | ||||
|     echo " Main Menu " | ||||
|     echo "-------------------------------------" | ||||
|     echo "[1] Show Todays date/time" | ||||
|     echo "[2] Show files in current directory" | ||||
|     echo "[3] Show calendar" | ||||
|     echo "[4] Start editor to write letters" | ||||
|     echo "[5] Exit/Stop" | ||||
|     echo "=======================" | ||||
|     echo -n "Enter your menu choice [1-5]: " | ||||
|     read yourch | ||||
|     case $yourch in | ||||
|       1) echo "Today is `date` , press a key. . ." ; read ;; | ||||
|       2) echo "Files in `pwd`" ; ls -l ; echo "Press a key. . ." ; read ;; | ||||
|       3) cal ; echo "Press a key. . ." ; read ;; | ||||
|       4) vi ;; | ||||
|       5) exit 0 ;; | ||||
|       *) echo "Opps!!! Please select choice 1,2,3,4, or 5"; | ||||
|          echo "Press a key. . ." ; read ;; | ||||
|  esac | ||||
| done | ||||
		Reference in New Issue
	
	Block a user