team-leader: Added todororovic/ folder (content done by Alexander Todorovic)
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@289 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
parent
712709362b
commit
ef67957b50
10 changed files with 566 additions and 0 deletions
8
todorovic/README.md
Normal file
8
todorovic/README.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Files from Alexander Todorovic
|
||||
|
||||
This folder contains work done by Alexander Todorovic, from the scripting team.
|
||||
Due to abscence of whatsoever communication with Marco Conterno, the scripting
|
||||
team team leader, these pages overlap with some of the content created by the
|
||||
team members that volunteered to help the scripting team. These pages are also
|
||||
not coded in Jekyll. For these reasons, everything in this folder is not in the
|
||||
website and is kept just for grading purposes.
|
82
todorovic/elif.html
Normal file
82
todorovic/elif.html
Normal file
|
@ -0,0 +1,82 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="mystyle.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="if-elif, unix, shell">
|
||||
<meta name="author" content="Aleksandar Todorovic">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>elif|if</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="nav">
|
||||
<ul>
|
||||
<li><a href="index.html">home</a></li>
|
||||
<li><a href="index_if.html">if</a>
|
||||
<ul>
|
||||
<li><a href="if.html"></a>if-fi</li>
|
||||
<li><a href="if-else.html"></a>if-else</li>
|
||||
<li class="current"><a href="elif.html"></a>if-elif</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="loops_index.html">Loops</a>
|
||||
<ul>
|
||||
<li><a href="while.html"></a>while</li>
|
||||
<li><a href="for.html"></a>for</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<div class="syntax">
|
||||
<h2>syntax of first case</h2>
|
||||
<P>if [ expresion 1 ] <br>
|
||||
then <br>
|
||||
statement to be executed if expresion 1 is true <br>
|
||||
elif [ expression 2 ] <br>
|
||||
then <br>
|
||||
statement to be executed if expresion 2 is true <br>
|
||||
elif [ expression 3 ] <br>
|
||||
then<br>
|
||||
statement to be executed if expresion 3 is true <br>
|
||||
else <br>
|
||||
statement to be executed if no expresion is true <br>
|
||||
fi <br>
|
||||
</P>
|
||||
<div class="notice">
|
||||
<h3>Explanation</h3>
|
||||
<P> On can use this command (expression) if we want select one of many blocks of code to execute. <br>
|
||||
It check one by one the expression and when is true it execute the statement and goes to next. <br>
|
||||
But if the expressions are false then it enters into else block and execute the else statement
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h2>Exemple</h2>
|
||||
<P>#!/bin/sh <br>
|
||||
var1=10 <br>
|
||||
var2=10 <br>
|
||||
if[ var1==1var2 ] <br>
|
||||
then <br>
|
||||
echo "var1 is equal var2" <br>
|
||||
elif [ $var1 -gt $var2 ] <br>
|
||||
then <br>
|
||||
echo "var1 is greater than var2"<br>
|
||||
elif [ $var1 -lt $var2 ] <br>
|
||||
then <br>
|
||||
echo "var1 is not equal var2"<br>
|
||||
else <br>
|
||||
echo "none of the condition is ok"<br>
|
||||
fi <br>
|
||||
</div>
|
||||
<footer>
|
||||
<h4>Source</h4>
|
||||
<ul>
|
||||
<li>https://www.shellscript.sh/loops.html</li>
|
||||
<li>https://www.autistici.org/loa/shodan/corsounix.pdf</li>
|
||||
<li>https://www.guru4technoworld.wix.com</li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
62
todorovic/for.html
Normal file
62
todorovic/for.html
Normal file
|
@ -0,0 +1,62 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="mystyle.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="for, loops, unix, shell">
|
||||
<meta name="author" content="Aleksandar Todorovic">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>for|loops</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="nav">
|
||||
<ul>
|
||||
<li><a href="index.html">home</a></li>
|
||||
<li><a href="index_if.html">if</a>
|
||||
<ul>
|
||||
<li><a href="if.html"></a>if-fi</li>
|
||||
<li><a href="if-else.html"></a>if-else</li>
|
||||
<li><a href="elif.html"></a>if-elif</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="loops_index.html">Loops</a>
|
||||
<ul>
|
||||
<li><a href="while.html"></a>while</li>
|
||||
<li class="current"><a href="for.html"></a>for</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<div class="syntax">
|
||||
<h2>syntax of For Loops</h2>
|
||||
<P>#!/bin/sh <br>
|
||||
for i in 1...N <br>
|
||||
do <br>
|
||||
Statement to be execudet for every word <br>
|
||||
done <br>
|
||||
</P>
|
||||
|
||||
<h2>Exemple</h2>
|
||||
#!/bin/sh <br>
|
||||
for i in 1 2 3 4 5 <br>
|
||||
echo "looping...number $1" <br>
|
||||
done <br>
|
||||
|
||||
<h3>Explanation</h3>
|
||||
<P> The for loops iterate a throught a set of value, list of item until is finished. <br>
|
||||
Practicaly this loop repeat a set of commands for each item of the list</P>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
<h4>Source</h4>
|
||||
<ul>
|
||||
<li>https://www.shellscript.sh/loops.html</li>
|
||||
<li>https://www.autistici.org/loa/shodan/corsounix.pdf</li>
|
||||
<li>https://www.guru4technoworld.wix.com</li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
69
todorovic/if-else.html
Normal file
69
todorovic/if-else.html
Normal file
|
@ -0,0 +1,69 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="mystyle.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="if-else, unix, shell">
|
||||
<meta name="author" content="Aleksandar Todorovic">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>if-else|if</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="nav">
|
||||
<ul>
|
||||
<li><a href="index.html">home</a></li>
|
||||
<li><a href="index_if.html">if</a>
|
||||
<ul>
|
||||
<li><a href="if.html"></a>if-fi</li>
|
||||
<li class="current"><a href="if-else.html"></a>if-else</li>
|
||||
<li><a href="elif.html"></a>if-elif</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="loops_index.html">Loops</a>
|
||||
<ul>
|
||||
<li><a href="while.html"></a>while</li>
|
||||
<li><a href="for.html"></a>for</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<div class="syntax">
|
||||
<h2>syntax of if-else</h2>
|
||||
<P>if [ expresion ] <br>
|
||||
then <br>
|
||||
statement to be executed if expresion is true <br>
|
||||
else <br>
|
||||
statement to be executed if expresion is false <br>
|
||||
fi <br>
|
||||
</P>
|
||||
<div class="notice">
|
||||
<h3>Explanation</h3>
|
||||
<P> This espression run if the conditional is true, than it execute the statement 1. <br>
|
||||
If the result of conditional expression is zero, it jump to "else part" and execute the statement 2. Finally after the execution of if/else, it resume with the consequent statement. </P>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<h2>Exemple</h2>
|
||||
<P>#!/bin/sh <br>
|
||||
var1=10 <br>
|
||||
var2=10
|
||||
if[ var1==1var2 ] <br>
|
||||
then <br>
|
||||
echo "var1 is equal var2" <br>
|
||||
else <br>
|
||||
echo "var1 is not equal var2"<br>
|
||||
fi
|
||||
</div>
|
||||
<footer>
|
||||
<h4>Source</h4>
|
||||
<ul>
|
||||
<li>https://www.shellscript.sh/loops.html</li>
|
||||
<li>https://www.autistici.org/loa/shodan/corsounix.pdf</li>
|
||||
<li>https://www.guru4technoworld.wix.com</li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
73
todorovic/if.html
Normal file
73
todorovic/if.html
Normal file
|
@ -0,0 +1,73 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="mystyle.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="if, unix, shell">
|
||||
<meta name="author" content="Aleksandar Todorovic">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>if|if</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="nav">
|
||||
<ul>
|
||||
<li><a href="index.html">home</a></li>
|
||||
<li><a href="index_if.html">if</a>
|
||||
<ul>
|
||||
<li class="current"><a href="if.html"></a>if-fi</li>
|
||||
<li><a href="if-else.html"></a>if-else</li>
|
||||
<li><a href="elif.html"></a>if-elif</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="loops_index.html">Loops</a>
|
||||
<ul>
|
||||
<li><a href="while.html"></a>while</li>
|
||||
<li><a href="for.html"></a>for</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<div class="syntax">
|
||||
|
||||
<h2>syntax of if</h2>
|
||||
<P>if [ expresion ] <br>
|
||||
then <br>
|
||||
statement to be executed if expresion is true <br>
|
||||
fi <br>
|
||||
</P>
|
||||
<div class="notice">
|
||||
<h3>Important notice</h3>
|
||||
<ul>
|
||||
<li>if expression is a shell comand, then it will be <br>
|
||||
assumed true if it return 0 after execution</li>
|
||||
<li>If it is a boolean expression, then it would be true <br>
|
||||
if it returns true</li>
|
||||
<li>Space between braces and expression it's important because <br>
|
||||
no space produce a syntax error</li>
|
||||
<li>"fi"is "if backward</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h2>Exemple</h2>
|
||||
<P>#!/bin/sh <br>
|
||||
var1=20 <br>
|
||||
var2=10
|
||||
if[ var1==1var2 ] <br>
|
||||
then <br>
|
||||
echo "var1 is equal var2" <br>
|
||||
fi
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
<h4>Source</h4>
|
||||
<ul>
|
||||
<li>https://www.shellscript.sh/loops.html</li>
|
||||
<li>https://www.autistici.org/loa/shodan/corsounix.pdf</li>
|
||||
<li>https://www.guru4technoworld.wix.com</li>
|
||||
</ul>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
60
todorovic/index.html
Normal file
60
todorovic/index.html
Normal file
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="if, loops, unix, shell">
|
||||
<meta name="author" content="Aleksandar Todorovic">
|
||||
<link rel="stylesheet" type="text/css" href="mystyle.css">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Home|index</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="nav">
|
||||
<ul>
|
||||
<li class="current"><a href="index.html">home</a></li>
|
||||
<li><a href="index_if.html">if</a>
|
||||
<ul>
|
||||
<li><a href="if.html"></a>if-fi</li>
|
||||
<li><a href="if-else.html"></a>if-else</li>
|
||||
<li><a href="elif.html"></a>if-elif</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="loops_index.html">Loops</a>
|
||||
<ul>
|
||||
<li><a href="while.html"></a>while</li>
|
||||
<li><a href="for.html"></a>for</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<div class="index">
|
||||
<P>In the following pages we briefly descibe some interesting commands on Unix with exemple:</P>
|
||||
<li>if
|
||||
<ul>
|
||||
<li>if-fi</li>
|
||||
<li>if-else</li>
|
||||
<li>if-elif</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>loops
|
||||
<ul>
|
||||
<li>while</li>
|
||||
<li>for</li>
|
||||
</ul>
|
||||
</li>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<h4>Source</h4>
|
||||
<ul>
|
||||
<li>https://www.shellscript.sh/loops.html</li>
|
||||
<li>https://www.autistici.org/loa/shodan/corsounix.pdf</li>
|
||||
<li>https://www.guru4technoworld.wix.com</li>
|
||||
</ul>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
52
todorovic/index_if.html
Normal file
52
todorovic/index_if.html
Normal file
|
@ -0,0 +1,52 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="if, unix, shell">
|
||||
<meta name="author" content="Aleksandar Todorovic">
|
||||
<link rel="stylesheet" type="text/css" href="mystyle.css">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>if|index</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="nav">
|
||||
<ul>
|
||||
<li><a href="index.html">home</a></li>
|
||||
<li class="current"><a href="index_if.html">if</a>
|
||||
<ul>
|
||||
<li><a href="if.html"></a>if-fi</li>
|
||||
<li><a href="if-else.html"></a>if-else</li>
|
||||
<li><a href="elif.html"></a>if-elif</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="loops_index.html">Loops</a>
|
||||
<ul>
|
||||
<li><a href="while.html"></a>while</li>
|
||||
<li><a href="for.html"></a>for</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<div class="index">
|
||||
<h1>If</h1>
|
||||
<h2>We have tree forms of if Statement:</h2>
|
||||
|
||||
<li>if-fi statement</li>
|
||||
<li>if-else statement</li>
|
||||
<li>if-elif else if</li>
|
||||
|
||||
<P>The "if" command it's most often invoked to test virtually every shell script</P>
|
||||
</div>
|
||||
<footer>
|
||||
<h4>Source</h4>
|
||||
<ul>
|
||||
<li>https://www.shellscript.sh/loops.html</li>
|
||||
<li>https://www.autistici.org/loa/shodan/corsounix.pdf</li>
|
||||
<li>https://www.guru4technoworld.wix.com</li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
51
todorovic/loops_index.html
Normal file
51
todorovic/loops_index.html
Normal file
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="lopps, Unix, shell">
|
||||
<meta name="author" content="Aleksandar Todorovic">
|
||||
<link rel="stylesheet" type="text/css" href="mystyle.css">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>loops|index</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="nav">
|
||||
<ul>
|
||||
<li><a href="index.html">home</a></li>
|
||||
<li><a href="index_if.html">if</a>
|
||||
<ul>
|
||||
<li><a href="if.html"></a>if-fi</li>
|
||||
<li><a href="if-else.html"></a>if-else</li>
|
||||
<li><a href="elif.html"></a>if-elif</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="current"><a href="loops_index.html">Loops</a>
|
||||
<ul>
|
||||
<li><a href="while.html"></a>while</li>
|
||||
<li><a href="for.html"></a>for</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<div class="index">
|
||||
<h1>loops</h1>
|
||||
<P>In programming Languages Loops are important because this concept allows us <br>
|
||||
to repeat a task many times whitout repeat every time code</P>
|
||||
<ul>
|
||||
<li>while</li>
|
||||
<li>for</li>
|
||||
</ul>
|
||||
</div>
|
||||
<footer>
|
||||
<h4>Source</h4>
|
||||
<ul>
|
||||
<li>https://www.shellscript.sh/loops.html</li>
|
||||
<li>https://www.autistici.org/loa/shodan/corsounix.pdf</li>
|
||||
<li>https://www.guru4technoworld.wix.com</li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
43
todorovic/mystyle.css
Normal file
43
todorovic/mystyle.css
Normal file
|
@ -0,0 +1,43 @@
|
|||
|
||||
body {font-family: , Arial, Elvetica, sans-serif;
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
padding: 0;
|
||||
margin: 0;}
|
||||
|
||||
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
header {
|
||||
background: #787878;
|
||||
color: white;
|
||||
padding-top: 20px; padding-bottom: -20px;
|
||||
min-height: 70px;
|
||||
border-bottom: #f0f0f0 3px solid;
|
||||
}
|
||||
|
||||
header a {
|
||||
color: #ffffff;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
header li {
|
||||
float: left;
|
||||
display: inline;
|
||||
padding: 0 10px 0 10px;
|
||||
}
|
||||
.index {
|
||||
margin: 10px;
|
||||
}
|
||||
.syntax {
|
||||
margin: 10px;
|
||||
}
|
||||
.current a {
|
||||
color: #000000;
|
||||
font-weight: bold;}
|
66
todorovic/while.html
Normal file
66
todorovic/while.html
Normal file
|
@ -0,0 +1,66 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="mystyle.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="loops, while, unix, shell">
|
||||
<meta name="author" content="Aleksandar Todorovic">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>while|loops</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="nav">
|
||||
<ul>
|
||||
<li><a href="index.html">home</a></li>
|
||||
<li><a href="index_if.html">if</a>
|
||||
<ul>
|
||||
<li><a href="if.html"></a>if-fi</li>
|
||||
<li><a href="if-else.html"></a>if-else</li>
|
||||
<li><a href="elif.html"></a>if-elif</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="loops_index.html">Loops</a>
|
||||
<ul>
|
||||
<li class="current"><a href="while.html"></a>while</li>
|
||||
<li><a href="for.html"></a>for</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<div class="syntax">
|
||||
<h2>syntax of While Loops</h2>
|
||||
<P>#!/bin/sh <br>
|
||||
while [ comand ] <br>
|
||||
do <br>
|
||||
statement to be exeuted if command is true <br>
|
||||
done <br>
|
||||
</P>
|
||||
|
||||
<h2>Exemple</h2>
|
||||
#!/bin/sh <br>
|
||||
INPUT_STRING=hello <br>
|
||||
while [ "$INPUT_STRING"!="bye" ] <br>
|
||||
do <br>
|
||||
echo "please type something in (bye to quit) <br>
|
||||
read INPUT_STRING <br>
|
||||
echo "You typed: $INPUT_STRING" <br>
|
||||
done <br>
|
||||
|
||||
<h3>Explanation</h3>
|
||||
<P>In this exemple "echo" and read statement run will go forward until we type "bye" <br>
|
||||
Normaly "while" command execute a code if this expression code is true, and stop only when is false or when say (type) stop.</P>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
<h4>Source</h4>
|
||||
<ul>
|
||||
<li>https://www.shellscript.sh/loops.html</li>
|
||||
<li>https://www.autistici.org/loa/shodan/corsounix.pdf</li>
|
||||
<li>https://www.guru4technoworld.wix.com</li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue