bonus2: add support for more special chars and fix syntax of parsed files
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@250 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
parent
0a563f9a1e
commit
03b3c1fe57
24 changed files with 107 additions and 137 deletions
|
@ -49,6 +49,9 @@ class HtmlParser(private val singlePage: Boolean) {
|
||||||
beginDocument()
|
beginDocument()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert special chars
|
||||||
|
changeSpecialChars()
|
||||||
|
|
||||||
// Convert html elements
|
// Convert html elements
|
||||||
changeBold()
|
changeBold()
|
||||||
changeBr()
|
changeBr()
|
||||||
|
@ -60,14 +63,14 @@ class HtmlParser(private val singlePage: Boolean) {
|
||||||
changeMono()
|
changeMono()
|
||||||
changeParagraph()
|
changeParagraph()
|
||||||
changeSection()
|
changeSection()
|
||||||
changeSpecials()
|
|
||||||
changeSubSection()
|
changeSubSection()
|
||||||
changeSubSubSection()
|
changeSubSubSection()
|
||||||
changeTable()
|
changeTable()
|
||||||
changeUnderline()
|
changeUnderline()
|
||||||
|
|
||||||
// Strip html comments
|
// Strip html comments and images
|
||||||
stripComments()
|
stripComments()
|
||||||
|
stripImg()
|
||||||
|
|
||||||
// Store the converted document
|
// Store the converted document
|
||||||
commit()
|
commit()
|
||||||
|
@ -100,11 +103,13 @@ class HtmlParser(private val singlePage: Boolean) {
|
||||||
content.toString()
|
content.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// No ned to save an empty document
|
// No ned to save an empty document
|
||||||
if (document.isEmpty()) {
|
if (document.isEmpty()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val outDir = File("out", if (singlePage) "" else File(outName).parent)
|
val outDir = File("out", if (singlePage) "" else File(outName).parent)
|
||||||
|
|
||||||
if (!outDir.exists()) {
|
if (!outDir.exists()) {
|
||||||
|
|
|
@ -27,7 +27,8 @@ class HtmlToLatexWriter(private var content: String, private val singlePage: Boo
|
||||||
fun beginDocument() {
|
fun beginDocument() {
|
||||||
insert("\\begin{document}", afterLine = true)
|
insert("\\begin{document}", afterLine = true)
|
||||||
insert("\\maketitle", afterLine = true)
|
insert("\\maketitle", afterLine = true)
|
||||||
insert("\\tableofcontents\\")
|
insert("\\tableofcontents", afterLine = true)
|
||||||
|
insert("\\newpage", afterLine = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,7 +114,7 @@ class HtmlToLatexWriter(private var content: String, private val singlePage: Boo
|
||||||
*/
|
*/
|
||||||
fun changeMono() {
|
fun changeMono() {
|
||||||
content = content.replaceTag("<pre>", "</pre>", "\\begin{verbatim}", "\\end{verbatim}")
|
content = content.replaceTag("<pre>", "</pre>", "\\begin{verbatim}", "\\end{verbatim}")
|
||||||
.replaceTag("{% highlight bash %}", "{% endhighlight %}",
|
.replaceTag("{\\% highlight bash \\%}", "{\\% endhighlight \\%}",
|
||||||
"\\begin{verbatim}", "\\end{verbatim}")
|
"\\begin{verbatim}", "\\end{verbatim}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,9 +143,9 @@ class HtmlToLatexWriter(private var content: String, private val singlePage: Boo
|
||||||
/**
|
/**
|
||||||
* Replace special html chars with LaTeX equivalents
|
* Replace special html chars with LaTeX equivalents
|
||||||
*/
|
*/
|
||||||
fun changeSpecials() {
|
fun changeSpecialChars() {
|
||||||
HTML_SPECIALS_FROM.forEachIndexed { index, s ->
|
SPECIAL_CHARS_HTML.forEachIndexed { index, s ->
|
||||||
content = content.replace(s, HTML_SPECIALS_TO[index])
|
content = content.replace(s, SPECIAL_CHARS_LATEX[index])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,6 +257,14 @@ class HtmlToLatexWriter(private var content: String, private val singlePage: Boo
|
||||||
content = content.replace(Regex("(?s)<!--.*?-->"), "")
|
content = content.replace(Regex("(?s)<!--.*?-->"), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the img tags
|
||||||
|
*/
|
||||||
|
fun stripImg() {
|
||||||
|
content = content.replace(Regex("(?s)<img.*?>"), "")
|
||||||
|
.replace("</img>", "")
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert content into the document
|
* Insert content into the document
|
||||||
*
|
*
|
||||||
|
@ -300,9 +309,18 @@ class HtmlToLatexWriter(private var content: String, private val singlePage: Boo
|
||||||
private const val HEADER =
|
private const val HEADER =
|
||||||
"\\documentclass[hidelinks,12pt,a4paper,numbers=enddot]{scrartcl}\n\n" +
|
"\\documentclass[hidelinks,12pt,a4paper,numbers=enddot]{scrartcl}\n\n" +
|
||||||
"\\usepackage[margin=2cm]{geometry}\n" +
|
"\\usepackage[margin=2cm]{geometry}\n" +
|
||||||
"\\usepackage{hyperref}"
|
"\\usepackage{hyperref}\n" +
|
||||||
|
"\\usepackage[utf8]{inputenc}"
|
||||||
|
|
||||||
private val HTML_SPECIALS_FROM = arrayOf("&", "<", ">", "'")
|
private val SPECIAL_CHARS_HTML =
|
||||||
private val HTML_SPECIALS_TO = arrayOf("\\&", "\\textless ", "\\textgreater ", "\'")
|
arrayOf("&", "<", ">", "'",
|
||||||
|
"©", "\\n", "[", "]",
|
||||||
|
"\$", "_", "#", "%",
|
||||||
|
"^")
|
||||||
|
private val SPECIAL_CHARS_LATEX =
|
||||||
|
arrayOf("\\&", "\\textless ", "\\textgreater ", "\'",
|
||||||
|
"(c)", "\\\\n", "\\[", "\\]",
|
||||||
|
"\\\$", "\\_", "\\#", "\\%",
|
||||||
|
"\\^")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ object Log {
|
||||||
/**
|
/**
|
||||||
* Log an exception as an error
|
* Log an exception as an error
|
||||||
*
|
*
|
||||||
* @param message The log message
|
* @param exception The error exception
|
||||||
* @param shouldThrow Whether the exception should be thrown
|
* @param shouldThrow Whether the exception should be thrown
|
||||||
*/
|
*/
|
||||||
fun <T : Exception> e(exception: T, shouldThrow: Boolean) {
|
fun <T : Exception> e(exception: T, shouldThrow: Boolean) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ The <code>colrm</code> is a command that removes the column that you indicate <b
|
||||||
|
|
||||||
Here we have a file named <code>example.txt</code> that contains two lines to test this command:<br>
|
Here we have a file named <code>example.txt</code> that contains two lines to test this command:<br>
|
||||||
|
|
||||||
{% highlight bash linenos %}
|
{% highlight bash %}
|
||||||
123456789
|
123456789
|
||||||
abcdefghi
|
abcdefghi
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
|
@ -13,7 +13,7 @@ Here we have two files named <code>example1.txt</code> and
|
||||||
<code>example2.txt</code> that contain 5 elements, to test this command:<br>
|
<code>example2.txt</code> that contain 5 elements, to test this command:<br>
|
||||||
|
|
||||||
<code>example1.txt</code>
|
<code>example1.txt</code>
|
||||||
{% highlight bash linenos %}
|
{% highlight bash %}
|
||||||
Icecream
|
Icecream
|
||||||
Chocolate
|
Chocolate
|
||||||
Cake
|
Cake
|
||||||
|
@ -22,7 +22,7 @@ Biscuit
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
<code>example2.txt</code>
|
<code>example2.txt</code>
|
||||||
{% highlight bash linenos %}
|
{% highlight bash %}
|
||||||
Bread
|
Bread
|
||||||
Chocolate
|
Chocolate
|
||||||
Tomato
|
Tomato
|
||||||
|
|
|
@ -15,7 +15,7 @@ Here we have two files named <code>example1.txt</code> and
|
||||||
<code>example2.txt</code> that contain 5 elements, to test this command:
|
<code>example2.txt</code> that contain 5 elements, to test this command:
|
||||||
|
|
||||||
<code>example1.txt</code>
|
<code>example1.txt</code>
|
||||||
{% highlight bash linenos %}
|
{% highlight bash %}
|
||||||
Car
|
Car
|
||||||
Computer
|
Computer
|
||||||
Robot
|
Robot
|
||||||
|
@ -24,7 +24,7 @@ Videogame
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
<code>example2.txt</code>
|
<code>example2.txt</code>
|
||||||
{% highlight bash linenos %}
|
{% highlight bash %}
|
||||||
Apple
|
Apple
|
||||||
Computer
|
Computer
|
||||||
Robot
|
Robot
|
||||||
|
|
|
@ -11,7 +11,7 @@ Through some flags you can decide how to filter this command.<br>
|
||||||
|
|
||||||
We have a file named <code>example.txt</code> that contains 5 elements, to test this command:
|
We have a file named <code>example.txt</code> that contains 5 elements, to test this command:
|
||||||
|
|
||||||
{% highlight bash linenos %}
|
{% highlight bash %}
|
||||||
Car
|
Car
|
||||||
Computer
|
Computer
|
||||||
Robot
|
Robot
|
||||||
|
@ -45,7 +45,7 @@ nl -b p^[cv] example.txt
|
||||||
Robot
|
Robot
|
||||||
Smartphone
|
Smartphone
|
||||||
</pre>
|
</pre>
|
||||||
<code>p^[cv]</code> says to nl to number only the lines that start with c and v.
|
The part after the flag is used to number only the lines that start with c and v.
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li> -b<b>n</b>: The flag n goes with b, doesn't number any lines
|
<li> -b<b>n</b>: The flag n goes with b, doesn't number any lines
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
---
|
|
||||||
layout: page
|
|
||||||
author: Agostino Monti
|
|
||||||
category-page: advanced
|
|
||||||
category-title: Advanced commands
|
|
||||||
tags: filie coluns analize
|
|
||||||
title: paste
|
|
||||||
---
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<p><code>paste</code> is a Unix command line utility which is used to join files horizontally
|
|
||||||
(parallel merging) by outputting lines consisting of the sequentially corresponding
|
|
||||||
lines of each file specified, separated by tabs, to the standard output.
|
|
||||||
Once involved, <code>paste</code> will read all its file arguments. For each corresponding line,
|
|
||||||
paste will append the contents of each file at that line to its output along with a tab.
|
|
||||||
When it has completed its operation for the last file, <code>paste</code> will output a newline
|
|
||||||
character and move on to the next line.</p>
|
|
||||||
|
|
||||||
<h3><code>cat</code></h3>
|
|
||||||
<p><code>cat</code> is a standard Unix utility that reads files sequentially, writing them to standard output.
|
|
||||||
The name is derived from its function to con<code>cat</code>enate files.</p>
|
|
||||||
|
|
||||||
<h4>Examples</h4>
|
|
||||||
<p><pre>
|
|
||||||
paste file1.txt file2.txt <br>
|
|
||||||
cat fail1.txt fail2.txt</pre></p>
|
|
||||||
|
|
||||||
<h3>flags</h3>
|
|
||||||
<ul>
|
|
||||||
<li><code>-d</code> delimiters, which specifies a list of delimiters to be used instead of tabs
|
|
||||||
for separating consecutive values on a single line. Each delimiter is used in turn;
|
|
||||||
when the list has been exhausted, paste begins again at the first delimiter.
|
|
||||||
<h4>Examples</h4>
|
|
||||||
<pre>
|
|
||||||
paste -d "|" file1.txt file2.txt
|
|
||||||
paste -d "|," file1.txt file2.txt</pre></li>
|
|
||||||
|
|
||||||
<li><code>-s</code>, which causes paste to append the data in serial rather than in parallel;
|
|
||||||
that is, in a horizontal rather than vertical fashion.
|
|
||||||
<h4>Examples</h4>
|
|
||||||
<pre>
|
|
||||||
paste -s file1.txt file2.txt</pre></li>
|
|
||||||
|
|
||||||
<li><code>-u</code> is one option flag, <code>-u</code> for unbuffered output,
|
|
||||||
meaning that each byte is written after it has been read.
|
|
||||||
<h4>Examples</h4>
|
|
||||||
<pre>
|
|
||||||
cat -u file1.txt file2.txt</pre></li>
|
|
||||||
|
|
||||||
<li><code>-n</code> this option numbers all output lines
|
|
||||||
<h4>Examples</h4>
|
|
||||||
<pre>
|
|
||||||
cat -n file1.txt
|
|
||||||
cat -n file1.txt file2.txt</pre></li>
|
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
|
|
@ -52,7 +52,7 @@ However, it is also possible to quit vi without saving the file.<br>
|
||||||
|
|
||||||
The cursor moves to bottom of screen whenever a colon (:) is
|
The cursor moves to bottom of screen whenever a colon (:) is
|
||||||
typed. This type of command is completed by hitting the
|
typed. This type of command is completed by hitting the
|
||||||
<Return> (or <Enter>) key.<br>
|
<Return> (or <Enter>) key.<br>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
:q
|
:q
|
||||||
|
|
|
@ -17,7 +17,7 @@ and to search for particular information by using special flags.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
info [flag] [item]
|
info [flag] [item]
|
||||||
</pre><br>
|
</pre>
|
||||||
|
|
||||||
<h3>Look up for a specific string</h3>
|
<h3>Look up for a specific string</h3>
|
||||||
<p>Using the <code>--apropos</code> flag followed by a string, you obtain as
|
<p>Using the <code>--apropos</code> flag followed by a string, you obtain as
|
||||||
|
@ -33,7 +33,7 @@ you will get a error message. For example:
|
||||||
<pre>
|
<pre>
|
||||||
info --apropos duck
|
info --apropos duck
|
||||||
info: No available info files have `duck' in their indices.
|
info: No available info files have `duck' in their indices.
|
||||||
</pre><br>
|
</pre>
|
||||||
|
|
||||||
<h3>An help with this command</h3>
|
<h3>An help with this command</h3>
|
||||||
Using the <code>-h</code> flag (which stands for help), you obtain as
|
Using the <code>-h</code> flag (which stands for help), you obtain as
|
||||||
|
|
|
@ -47,7 +47,7 @@ They are not flags. For a single operation there can be multiple commands.
|
||||||
Scroll horizontally right N characters, by default half of the screen size, if N is not specified.</li>
|
Scroll horizontally right N characters, by default half of the screen size, if N is not specified.</li>
|
||||||
<li><code> ESC-( LeftArrow </code>
|
<li><code> ESC-( LeftArrow </code>
|
||||||
Scroll horizontally left N characters, by default half of the screen size, if N is not specified. </li>
|
Scroll horizontally left N characters, by default half of the screen size, if N is not specified. </li>
|
||||||
</ul><br>
|
</ul>
|
||||||
|
|
||||||
<h3>Jumping</h3>
|
<h3>Jumping</h3>
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ They are not. For a single operation there can be multiple commands. </p>
|
||||||
Go to the (N-th) next tag. </li>
|
Go to the (N-th) next tag. </li>
|
||||||
<li><code> T </code>
|
<li><code> T </code>
|
||||||
Go to the (N-th) previous tag.</li>
|
Go to the (N-th) previous tag.</li>
|
||||||
</ul><br>
|
</ul>
|
||||||
|
|
||||||
<h3>Flags</h3>
|
<h3>Flags</h3>
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ interface opens. Now you can work on the opened file.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
open path/name-file
|
open path/name-file
|
||||||
</pre><br>
|
</pre>
|
||||||
|
|
||||||
<h3>Open a file with a specific application</h3>
|
<h3>Open a file with a specific application</h3>
|
||||||
Adding the flag <code>-a</code> to the command permit you to decide with
|
Adding the flag <code>-a</code> to the command permit you to decide with
|
||||||
|
|
|
@ -28,7 +28,7 @@ reading the content of that file.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
say -f path/text.txt
|
say -f path/text.txt
|
||||||
</pre><br>
|
</pre>
|
||||||
|
|
||||||
<h3>Specify the reading voice</h3>
|
<h3>Specify the reading voice</h3>
|
||||||
By writing the flag <code>-v</code> followed by a person name and a string, you
|
By writing the flag <code>-v</code> followed by a person name and a string, you
|
||||||
|
@ -44,7 +44,7 @@ so, by writing a string (eg: "Hello world") as argument of the command
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
say -v "Hello world"
|
say -v "Hello world"
|
||||||
</pre><br>
|
</pre>
|
||||||
|
|
||||||
<h3>Specify the Speech Rate</h3>
|
<h3>Specify the Speech Rate</h3>
|
||||||
By writing the flag <code>-r</code> followed by a rate and then by a
|
By writing the flag <code>-r</code> followed by a rate and then by a
|
||||||
|
@ -52,7 +52,7 @@ string, you can decide the reading speed in words per minute.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
ay -r rate string
|
ay -r rate string
|
||||||
</pre><br>
|
</pre>
|
||||||
|
|
||||||
<h3>Store the output in an audible file</h3>
|
<h3>Store the output in an audible file</h3>
|
||||||
You can save the result of the command in an audible file. To do that,
|
You can save the result of the command in an audible file. To do that,
|
||||||
|
|
|
@ -15,13 +15,13 @@ Basic syntax is in the form
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
install [OPTION]... SOURCE DEST
|
install [OPTION]... SOURCE DEST
|
||||||
</pre><br>
|
</pre>
|
||||||
|
|
||||||
This line of code copies all .xyz file from <i>/source/folder</i> to <i>/destination/folder</i>
|
This line of code copies all .xyz file from <i>/source/folder</i> to <i>/destination/folder</i>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
install -D /source/folder/*.xyz /destination/folder
|
install -D /source/folder/*.xyz /destination/folder
|
||||||
</pre><br>
|
</pre>
|
||||||
|
|
||||||
<h3>Flags</h3>
|
<h3>Flags</h3>
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ md5 -s "Hello there"
|
||||||
|
|
||||||
<h3>Flags</h3>
|
<h3>Flags</h3>
|
||||||
|
|
||||||
<ul>q
|
<ul>
|
||||||
<li><b>-s</b>: computes the md5 sum of a string instead of a file</li>
|
<li><b>-s</b>: computes the md5 sum of a string instead of a file</li>
|
||||||
<li><b>-q</b>: prints the md5 sum without the file or string name</li>
|
<li><b>-q</b>: prints the md5 sum without the file or string name</li>
|
||||||
<li><b>-r</b>: reverses the format of the output</li>
|
<li><b>-r</b>: reverses the format of the output</li>
|
||||||
|
|
|
@ -22,14 +22,14 @@ The main usages for the <code>ping</code> command are:
|
||||||
<li>Test whether remote server if working.</li>
|
<li>Test whether remote server if working.</li>
|
||||||
<li>Check the network connectivity from your local machine to a remote one.</li>
|
<li>Check the network connectivity from your local machine to a remote one.</li>
|
||||||
<li>Check for general network issues.</li>
|
<li>Check for general network issues.</li>
|
||||||
<ol>
|
</ol>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
ping theshell.ch
|
ping theshell.ch
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
The shell will output something like this:
|
The shell will output something like this:
|
||||||
<i>64 bytes from 98.138.219.232: icmp_seq=0 ttl=49 time=144.781 ms </i>for each packets
|
<i>64 bytes from 98.138.219.232: icmp_seq=0 ttl=49 time=144.781 ms</i> for each packet
|
||||||
that returns (echoed back).<br>
|
that returns (echoed back).<br>
|
||||||
|
|
||||||
To stop the ping command press <code>control + c</code>.
|
To stop the ping command press <code>control + c</code>.
|
||||||
|
|
|
@ -23,9 +23,7 @@ remote-server:[~]>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
Once you're logged in, the local machine shell will be
|
Once you're logged in, the local machine shell will be
|
||||||
<i>replaced</i> by the remote server's one
|
<i>replaced</i> by the remote server's one.<br>
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<h3>Log out of a server</h3>
|
<h3>Log out of a server</h3>
|
||||||
|
|
||||||
|
|
|
@ -19,18 +19,19 @@ Here are just some of the most useful options for this command:
|
||||||
<li>-b: Display time of last system boot.</li>
|
<li>-b: Display time of last system boot.</li>
|
||||||
<li> -d: Print dead processes.</li>
|
<li> -d: Print dead processes.</li>
|
||||||
<li>-H: Write column headings above the regular output.</li>
|
<li>-H: Write column headings above the regular output.</li>
|
||||||
<li>-m: Only print information about the current terminal. This is the
|
<li>-m: Only print information about the current terminal.</li>
|
||||||
POSIX way of saying who am i.</li>
|
|
||||||
<li>-q: <i>Quick mode</i>: List only the names and the number of users currently logged on.
|
<li>-q: <i>Quick mode</i>: List only the names and the number of users currently logged on.
|
||||||
When this option is used, all other options are
|
When this option is used, all other options are
|
||||||
ignored.</li>
|
ignored.
|
||||||
|
</li>
|
||||||
<li>-s: List only the name, line and time fields. This is the default.</li>
|
<li>-s: List only the name, line and time fields. This is the default.</li>
|
||||||
<li>-T: Print a character after the user name indicating the state of the
|
<li>-T: Print a character after the user name indicating the state of the
|
||||||
terminal line: "+" if the terminal is writable; "-" if it is not;
|
terminal line: "+" if the terminal is writable; "-" if it is not;
|
||||||
and "?" if a bad line is encountered.</li>
|
and "?" if a bad line is encountered.
|
||||||
|
</li>
|
||||||
<li>-u: Print the idle time for each user, and the associated process ID.</li>
|
<li>-u: Print the idle time for each user, and the associated process ID.</li>
|
||||||
<li>am I: Returns the invoker's real user name. You can also use <code>whoami</code></li>
|
<li>am I: Returns the invoker's real user name. You can also use <code>whoami</code></li>
|
||||||
<li>file: By default, who gathers information from the file /var/run/utmpx.
|
<li>file: By default, who gathers information from the file /var/run/utmpx.
|
||||||
An alternative file may be specified.</li>
|
An alternative file may be specified.
|
||||||
<ul>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -14,7 +14,7 @@ It stands for <i>ReMove</i>.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
rm [-dfiPRrvW] file1 file2 file....
|
rm [-dfiPRrvW] file1 file2 file....
|
||||||
</pre><br>
|
</pre>
|
||||||
|
|
||||||
<h3>Flags</h3>
|
<h3>Flags</h3>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -39,7 +39,7 @@ rm [-dfiPRrvW] file1 file2 file....
|
||||||
<li> <b>-v</b>: Be verbose when deleting files, showing them as they are removed.</li>
|
<li> <b>-v</b>: Be verbose when deleting files, showing them as they are removed.</li>
|
||||||
<li> <b>-W</b>: Attempt to undelete the named files.
|
<li> <b>-W</b>: Attempt to undelete the named files.
|
||||||
Currently, this option can only be used to recover files covered by whiteouts.</li>
|
Currently, this option can only be used to recover files covered by whiteouts.</li>
|
||||||
</ul><br>
|
</ul>
|
||||||
|
|
||||||
<h3>Removing links</h3>
|
<h3>Removing links</h3>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ author: Joey Bevilacqua
|
||||||
title: Navigation
|
title: Navigation
|
||||||
---
|
---
|
||||||
|
|
||||||
You can navigate in our website with your keyboard using some tricks:
|
You can navigate in our website with your keyboard using some tricks:<br>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -87,3 +87,5 @@ You can navigate in our website with your keyboard using some tricks:
|
||||||
<td>Brings you to the about topic page</td>
|
<td>Brings you to the about topic page</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
The navigation shortcuts will not be available when you're doing a search through the search bar.
|
||||||
|
|
|
@ -7,10 +7,8 @@ author: Joey Bevilacqua
|
||||||
title: Who we are
|
title: Who we are
|
||||||
---
|
---
|
||||||
|
|
||||||
<p>
|
|
||||||
<ul>
|
<ul>
|
||||||
{% for item in site.authors %}
|
{% for item in site.authors %}
|
||||||
<li><b>{{ item.name }}</b>: {{ item.position }}</li>
|
<li><b>{{ item.name }}</b>: {{ item.position }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
|
||||||
|
|
|
@ -7,27 +7,34 @@ author: Matteo Omenetti
|
||||||
title: About the project
|
title: About the project
|
||||||
---
|
---
|
||||||
|
|
||||||
<img id="time-line" src="../../assets/info/Timeline.jpg" alt="Timeline of the project" width="500px"</img>
|
<img id="time-line" src="../../assets/info/Timeline.jpg" alt="Timeline of the project" width="500px"</img><br>
|
||||||
<br>
|
|
||||||
This is the final project of the course “Software Atelier 1” hosted by the University of Lugano.<br>
|
This is the final project of the course “Software Atelier 1” hosted by the University of Lugano.<br>
|
||||||
For this project, the informatics students of the first year got divided into two groups,
|
|
||||||
each made up of 25 students.<br>
|
For this project, the informatics students of the first year got divided into two groups,
|
||||||
The goal of this project was to put into practice all the skills obtained during the entire
|
each made up of 25 students.<br>
|
||||||
duration of this course: Latex, HTML, CSS, Unix Shell and SVN.<br><br>
|
|
||||||
The students had about 4 weeks to develop, from the ground up, this 100 pages website.<br>
|
The goal of this project was to put into practice all the skills obtained during the entire
|
||||||
A great coordination was needed to develop
|
duration of this course: Latex, HTML, CSS, Unix Shell and SVN.<br>
|
||||||
such a big website in such a short time. For this reason some students had to take care of
|
|
||||||
specific tasks, such as managing the SVN repository and developing the CSS templates.<br>
|
The students had about 4 weeks to develop, from the ground up, this 100 pages website.<br>
|
||||||
Our topic (Unix Shell) got divided into three macro sections, each taking care of a
|
|
||||||
number of commands based on their advancement level, therefore there is a basic,
|
A great coordination was needed to develop
|
||||||
intermediate and advance section commands.<br>
|
such a big website in such a short time. For this reason some students had to take care of
|
||||||
Each macro section had its own leader, that was responsible for overseeing the conduct
|
specific tasks, such as managing the SVN repository and developing the CSS templates.<br>
|
||||||
of the other team members within his group.
|
|
||||||
hen each team leader reported back to group leader, that was responsible for the success
|
Our topic (Unix Shell) got divided into three macro sections, each taking care of a
|
||||||
of the entire project.<br>
|
number of commands based on their advancement level, therefore there is a basic,
|
||||||
The ultimate goal of this website is to provide, to the future first-year students,
|
intermediate and advance section commands.<br>
|
||||||
a useful and human readable guide that can guide
|
|
||||||
them through the learning process of this fundamental tool. This website in intended
|
Each macro section had its own leader, that was responsible for overseeing the conduct
|
||||||
to be a guide that can be followed, understood and
|
of the other team members within his group.
|
||||||
found interesting by anyone, since it starts from the really basic concepts of the shell,
|
Then each team leader reported back to group leader, that was responsible for the success
|
||||||
all the way to the most advanced and foremost commands.
|
of the entire project.<br>
|
||||||
|
|
||||||
|
The ultimate goal of this website is to provide, to the future first-year students,
|
||||||
|
a useful and human readable guide that can guide
|
||||||
|
them through the learning process of this fundamental tool. This website in intended
|
||||||
|
to be a guide that can be followed, understood and
|
||||||
|
found interesting by anyone, since it starts from the really basic concepts of the shell,
|
||||||
|
all the way to the most advanced and foremost commands.
|
||||||
|
|
|
@ -51,11 +51,11 @@ If our indices are all sequential and we just want to change the starting index,
|
||||||
names=([12]="Luigi" "Mario" "Nate")
|
names=([12]="Luigi" "Mario" "Nate")
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
Which will create an array with <code>"Luigi"</code> at index 12,
|
Which will create an array with <i>"Luigi"</i> at index 12,
|
||||||
<code>"Mario"</code> at index 13 and <code>"Nate"</code> at index 14.<br>
|
<i>"Mario"</i> at index 13 and <i>"Nate"</i> at index 14.<br>
|
||||||
An indexed array's selector can also be negative, which will start counting from the end,
|
An indexed array's selector can also be negative, which will start counting from the end,
|
||||||
so <code>${names[-1]}</code> means <code>"Nate"</code>, <code>${names[-3]</code> is
|
so <i>${names[-1]}</i> means <i>"Nate"</i>, <code>${names[-3]}</code> is
|
||||||
<code>"Luigi"</code> and so on.<br>
|
<i>"Luigi"</i> and so on.<br>
|
||||||
|
|
||||||
The other kind of array is an <i>associative</i> array.
|
The other kind of array is an <i>associative</i> array.
|
||||||
In an associative array, the values are not mapped to a number but to some other string.<br>
|
In an associative array, the values are not mapped to a number but to some other string.<br>
|
||||||
|
@ -102,8 +102,7 @@ is equivalent to <code>"Mario" "Luigi"</code>, while
|
||||||
${#names[@]}
|
${#names[@]}
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
counts the number of elements in the array, in this case 3.<br>
|
counts the number of elements in the array, in this case 3.<br><br>
|
||||||
|
|
||||||
<br>
|
|
||||||
Further reading: <a href="http://www.gnu.org/software/bash/manual/bashref.html#Arrays">
|
Further reading: <a href="http://www.gnu.org/software/bash/manual/bashref.html#Arrays">
|
||||||
the bash reference manual</a>
|
the bash reference manual</a>
|
||||||
|
|
|
@ -26,9 +26,9 @@ For loops take this form:
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
for VARIABLE in 1 2 3 4 5 .. N
|
for VARIABLE in 1 2 3 4 5 .. N
|
||||||
do
|
do
|
||||||
command1
|
command1
|
||||||
command2
|
command2
|
||||||
commandN
|
commandN
|
||||||
done
|
done
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
<!-- End of Introduction -->
|
<!-- End of Introduction -->
|
||||||
|
|
Loading…
Reference in a new issue