code-review: internal code review 1

git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@86 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
bevilj 2018-11-10 21:05:37 +00:00
parent 07cbd5656c
commit dcb5ea0b2f
24 changed files with 254 additions and 404 deletions

View File

@ -64,7 +64,7 @@ This is an example for a page with the following stuff:
\begin{lstlisting}[language=html]
---
layout: page
category_title: Basic commands
category-title: Basic commands
category-page: basic
tags: directory list
author: Claudio Maggioni

View File

@ -5,11 +5,11 @@
<meta name="author" content="{{ page.author }}">
<title>{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %}</title>
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
<!-- fonts -->
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet">
<link rel="stylesheet" href="{{ "/main.css" | prepend: site.baseurl | prepend: site.url }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.2/css/all.css" integrity="sha384-/rXc/GQVaYpyDdyxK+ecHPVYJSN9bmVFBvjA/9eOB+pb3F2w2N6fc5qB9Ew5yIns" crossorigin="anonymous">

View File

@ -1,30 +1,28 @@
<div class="menuDesktop">
<div class="logo">
<a href="/index.html"><img src="/assets/style/logo_white.png" height="50"></a>
<div class="logo">
<a href="/index.html"><img src="/assets/style/logo_white.png" height="50"></a>
</div>
<div class="fill-space"></div>
<div class="search-box"><input type="text" id="search-bar"><label for="search-bar"><img src="/assets/style/search_icon.png"></label>
<ul id="search-results">
</ul>
</div>
<div class="fill-space"></div>
<div class="search-box"><input type="text" id="search-bar"><label for="search-bar"><img src="/assets/style/search_icon.png"></label>
<ul id="search-results">
</ul>
</div>
<nav class="nav-menu">
<div>Learn
<ul>
<li><a href="{{ site.baseurl }}/pages/topic/cmd/basic.html">Basic commands</a></li>
<li><a href="{{ site.baseurl }}/pages/topic/cmd/interm.html">Intermediate commands</a></li>
<li><a href="{{ site.baseurl }}/pages/topic/cmd/advanced.html">Advanced commands</a></li>
<li><a href="{{ site.baseurl }}/pages/topic/fs/fs.html">Filesystem</a></li>
<li><a href="#">Scripting</a></li>
<li><a href="{{ site.baseurl }}/pages/topic/fs.html">Filesystem</a></li>
<li><a href="{{ site.baseurl }}/pages/topic/scripts.html">Scripting</a></li>
</ul>
</div>
<code>|</code>
<div>About
<ul>
<li><a href="#">Us</a></li>
<li><a href="#">The project</a></li>
<li><a href="#">INTRO</a></li>
<li><a href="{{ site.baseurl }}/pages/info/motivation.html">Us</a></li>
<li><a href="{{ site.baseurl }}/pages/info/project.html">The project</a></li>
</ul>
</div>
</nav>
</div>

View File

@ -1,6 +1,6 @@
---
layout: page
category_title: Basic commands
category-title: Basic commands
category-page: basic
tags: directory change navigate
author: Marinelli Alessandro

View File

@ -1,6 +1,6 @@
---
layout: page
category_title: Basic commands
category-title: Basic commands
category-page: basic
tags: directory list
author: Marinelli Alessandro

View File

@ -1,6 +1,6 @@
---
layout: page
category_title: Basic commands
category-title: Basic commands
category-page: basic
tags: manual
author: De Vita Gianmarco

View File

@ -1,35 +1,34 @@
---
layout: page
category: Intermediate commands
tags: basename
category-page: intermediate
category-title: Intermediate commands
tags: basename suffix prefix name
author: Fabiano Fenini
title: BASENAME
next-page: ""
title: basename
---
<p>The <code>basename</code> command deletes any prefix ending with the last slash "/" character present in string and also a suffix.
</p>
<p>The <code>basename</code> command deletes any prefix ending with the last slash "/" character
present in string and also a suffix.
<h2>Usage<h2>
<h2>Usage</h2>
<p>The default basename command syntax is:
The default basename command syntax is:
<pre>
basename [flags] [string] [suffix]
</pre>
Where [flags] are the cat flags, read below for more info, the string command is the pathname and the suffix, if indicated, will be also deleted.
Where [flags] are the cat flags, read below for more info, the string command is
the pathname and the suffix, if indicated, will be also deleted.
</p>
<h2>Flags</h2>
<h2>Flags<h2>
<p>Here are some of the most common basename flags:
Here are some of the most common basename flags:
<ul>
<li> <b>-a</b>: Every aregument is treated as a string </li>
<li> <b>-s</b>: The suffix is taken as its argument </li>
<li> <b>-a</b>: Supports multiple arguments and they will be treated as a name </li>
<li> <b>-a</b>: Every aregument is treated as a string </li>
<li> <b>-s</b>: The suffix is taken as its argument </li>
<li> <b>-a</b>: Supports multiple arguments and they will be treated as a name </li>
</ul>
</p>

View File

@ -1,32 +1,34 @@
---
layout: page
category: Intermediate commands
tags: cat
category-page: intermediate
tags: cat content file show concatenate
author: Fabiano Fenini
title: CAT
next-page: ""
title: cat
---
<p>The <code>cat</code> command can be easily associated to the word “concatenation” but it doesnt have that only function: in fact, cat command gives us the possibility to create files and also to display them.
</p>
<p>The <code>cat</code> command can be easily associated to the word “concatenation” but
it doesnt have that only function: in fact, cat command gives us the possibility to create
files and also to display them.
<br>
The name stands for <i>catenate</i>.
<h2>Usage<h2>
<h2>Usage</h2>
<p>The default cat command syntax is:
The default cat command syntax is:
<pre>
cat [flags] [--] [file1] [file2 ...] ]
cat [flags] [--] [file1] [file2] [file...]
</pre>
Where [flags] are the cat flags, read below for more info, [--] indacates that the following parameters won't be considered as flags, while the file parameters indicates the names of one or more files to concatenate.
Between the names of two files is possible to use the shell redirection symbol ">", in order to redirect the output to the file considered.
Where [flags] are the cat flags, read below for more info, [--] indacates that the
following parameters won't be considered as flags, while the file parameters indicates
the names of one or more files to concatenate.
Between the names of two files is possible to use the shell redirection symbol "&gt;",
in order to redirect the output to the file considered.
</p>
<h2>Flags<h2>
<p>Here are some of the most common cat flags:
<h2>Flags</h2>
Here are some of the most common cat flags:
<ul>
<li> <b>-n</b>: Display the line numbers of a file </li>

View File

@ -0,0 +1,40 @@
---
layout: page
category: Intermediate commands
category-page: intermediate
tags: password change pwd user
author: Fabiano Fenini
title: passwd
previous-page: ""
---
<p>The <code>passwd</code> command allows us to change or to assign a password of authentication
of an user currently in the system.<br>
When the user doesnt have particular privileges, he is only able to change is password,
while the root user has the possibility to change also other users passwords.<br>
The command name stands for <i>password</i>.
<h2>Usage</h2>
The default passwd command syntax is:
<pre>
passwd [flags] [user]
</pre>
Where [flags] are the passwd flags, read below for more info, the parameter [user] can only be
specified by the root user. If no user is provided, passwd proceed to set the password of the
user who uses this command. You will first be asked to enter the current user password.
<h2>Flags</h2>
Here are some of the most common passwd flags:
<ul>
<li> <b>-d</b>: Delete the user password </li>
<li> <b>-h</b>: Get information about how to use this command </li>
<li> <b>-l</b>: Lock the password </li>
<li> <b>-u</b>: Unlock the password </li>
<li> <b>-S</b>: See the account status information </li>
</ul>
</p>

View File

@ -1,36 +0,0 @@
---
layout: page
category: Intermediate commands
tags: password
author: Fabiano Fenini
title: PASSWD
previous-page: ""
---
<p>The <code>passwd</code> command allows us to change or to assign a password of authentication of an user currently in the system. When the user doesnt have particular privileges, he is only able to change is password, while the root user has the possibility to change also other users passwords.<br>
The name stands for <i>password</i>.
<h2>Usage<h2>
<p>The default passwd command syntax is:
<pre>
passwd [flags] [user]
</pre>
Where [flags] are the passwd flags, read below for more info, the parameter [user] can only be specified by the root user. If no user is provided, passwd proceed to set the password of the user who uses this command. You will first be asked to enter the user password.
</p>
<h2>Flags<h2>
<p>Here are some of the most common passwd flags:
<ul>
<li> <b>-d</b>: Delete the user password </li>
<li> <b>-h</b>: Get information about how to use this command </li>
<li> <b>-l</b>: Lock the password </li>
<li> <b>-u</b>: Unlock the password </li>
<li> <b>-S</b>: See the account status information </li>
</ul>
</p>

View File

@ -1,6 +1,7 @@
---
layout: page
category: Filesystem
category-page: fs
category-title: FileSystem
tags: absolute relative path
author: Marwan Announ
title: fs

View File

@ -1,6 +1,7 @@
---
layout: page
category: Filesystem
category-page: fs
category-title: FileSystem
tags: absolute relative path
author: Marwan Announ
title: fs

View File

@ -1,83 +1,25 @@
---
layout: page
category_title: File System
category-page: Manipulating
tags: directory list
category-page: fs
category-title: FileSystem
tags: directory list move rename
author: Mattia Hijman
title: mv
previous-page: group-1/site/pages/fs/mv.html
---
<h1> Move Command </h1>
<h2>NAME</h2>
<p>mv -- move files</p>
<h2>SYNOPSIS</h2>
<p>mv [-f | -i | -n] [-v] source target</p>
<p>mv [-f | -i | -n] [-v] source ... directory</p>
<p>The <code>mv</code> command is used to move a file from a given path to another. It can also be used to rename a file by moving it into the same directory, but with a different name.<br>
It stands for <i>MoVe</i>.
<h2>DESCRIPTION</h2>
<p>In its first form, the mv utility renames the file named by the source operand to the destination path named by the target operand.
This form is assumed when the last operand does not name an already existing directory.</p>
<pre>
mv [-finv] source target
</pre>
<p>In its second form, mv moves each file named by a source operand to a destination file in the existing directory named by the directory operand.
The destination path for each operand is the pathname produced by the concatenation of the last operand, a slash, and the final pathname component of the named file.</p>
<h2>Flags</h2>
<p>The following options are available:</p>
<p>-f
<p>Do not prompt for confirmation before overwriting the destination path. (The -f option overrides any previous -i or -n options.)
<p>-i
<p>Cause mv to write a prompt to standard error before moving a file that would overwrite an existing file. If the response from the standard input begins with the character `y' or `Y', the move is attempted. (The -i option overrides any previous -f or -n options.)
<p>-n
<p>Do not overwrite an existing file. (The -n option overrides any previous -f or -i options.)
<p>-v
<p>Cause mv to be verbose, showing files after they are moved.
<p>It is an error for either the source operand or the destination path to specify a directory unless both do.
<p>If the destination path does not have a mode which permits writing, mv prompts the user for confirmation as specified for the -i option.
<p>As the rename(2) call does not work across file systems, mv uses cp(1) and rm(1) to accomplish the move. The effect is equivalent to:
<ul>
<li>rm -f destination_path && \</li>
<li>cp -pRP source_file destination && \</li>
<li>rm -rf source_file</li>
<li> <b>-f</b>: Do not prompt for confirmation before overwriting the
destination path.</li>
<li> <b>-i</b>: Asks user confirmation before proceeding.</li>
<li> <b>-n</b>: Do not overwrite an existing file.</li>
<li> <b>-v</b>: Cause mv to be verbose, showing files after they are moved.</li>
</ul>
<h2>DIAGNOSTICS</h2>
<p>The command "mv dir/afile dir" will abort with an error message.<p>
LEGACY DIAGNOSTICS
<p>In legacy mode, the command "mv dir/afile dir" will fail silently, returning an exit code of 0.<p>
<p>For more information about legacy mode, see compat(5).<p>
<h2>SEE ALSO</h2>
<ul>
<li>cp(1)</li>
<li>rm(1)</li>
<li>symlink(7)</li>
</ul>
<h2>COMPATIBILITY</h2>
<p>The -n and -v options are non-standard and their use in scripts is not recommended.<p>
<p>The mv utility now supports HFS+ Finder and Extended Attributes and
resource forks. The mv utility will no longer strip resource forks off of HFS files. For an alternative method, refer to cp(1).</p>
<h2>STANDARDS</h2>
<p>The mv utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible.</p>
<h2>HISTORY</h2>
<p>A mv command appeared in Version 1 AT&T UNIX.</p>

View File

@ -1,18 +0,0 @@
---
layout: page
category: File System
tags: absolute relative path
author: Marwan Announ
title: fs
---
<h1>ABSOLUTE VS RELATIVE</h1>
<p>
Now, you can ask, why I have to use one or another?
<br> What is the difference? and questions like this.
<br> <br> <br> Don't worry, the answer it's easy.., we can use an absolute path from any location
<br> whereas you want to use relative path we should be present that you have to be in the working directory.
</p>
<!-- quiz about absolute vs relative, where the user have to choose one or another(javascript) -->

View File

@ -1,116 +1,55 @@
---
layout: page
category_title: File System
category-page: Manipulating
tags: directory list
category-page: fs
category-title: FileSystem
tags: directory list remove delete erase
author: Mattia Hijman
title: rm
previous-page: group-1/site/pages/fs/rm.html
---
<h1>Remove Command</h1>
<h>NAME</h>
<p>rm, unlink -- remove directory entries</p>
<p>The <code>rm</code> command is used to delete and unlink directories and files.<br>
It attempts to remove the non-directory type files specified on the command line.
If the permissions of the file do not permit writing, the user is prompted for confirmation.<br>
It stands for <i>ReMove</i>.
<h>SYNOPSIS</h>
<pre>
rm [-dfiPRrvW] file1 file2 file....
</pre>
rm [-dfiPRrvW] file ...
unlink file
<h>DESCRIPTION</h>
<p>The rm utility attempts to remove the non-directory type files specified on the command line.
If the permissions of the file do not permit writing, and the standard input device is a terminal,
the user is prompted (on the standard error output) for confirmation.</p>
<p>The options are as follows:</p>
<p>-d</p>
<p>Attempt to remove directories as well as other types of files.</p>
<p>-f</p>
<p>Attempt to remove the files without prompting for confirmation, regardless of the file's permissions.
If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error.
The -f option overrides any -i options.</p>
<p>-i</p>
<p>Request confirmation before attempting to remove each file, regardless of the file's permissions, or whether or not the standard input device is a terminal.
The -i option overrides any previous -f options.</p>
<p>-P</p>
<p>Overwrite regular files before deleting them.
Files are overwritten three times, first with the byte pattern 0xff, then 0x00, and then 0xff again, before they are deleted.</p>
<p>-R</p>
<p>Attempt to remove the file hierarchy rooted in each file argument.
The -R option implies the -d option. If the -i option is specified, the user is prompted for confirmation before each directory's contents are processed (as well as before the attempt is made to remove the directory).
If the user does not respond affirmatively, the file hierarchy rooted in that directory is skipped.</p>
<p>-r </p>
<p>Equivalent to -R.</p>
<p>-v</p>
<p>Be verbose when deleting files, showing them as they are removed.</p>
<p>-W</p>
<p>Attempt to undelete the named files.
Currently, this option can only be used to recover files covered by whiteouts.</p>
<p>The rm utility removes symbolic links, not the files referenced by the links.</p>
<p>It is an error to attempt to remove the files ``.'' or ``..''.</p>
<p>When the utility is called as unlink, only one argument, which must not be a directory, may be supplied.
No options may be supplied in this simple mode of operation, which performs an unlink(2) operation on the passed argument.</p>
<p>The rm utility exits 0 if all of the named files or file hierarchies were removed, or if the -f option was specified and all of the existing files or file hierarchies were removed.
If an error occurs, rm exits with a value >0.</p>
<h>NOTE</h>
<p>The rm command uses getopt(3) to parse its arguments, which allows it to accept the `--' option which will cause it to stop processing flag options at that point.
This will allow the removal of file names that begin with a dash (`-'). For example:</p>
<h2>Flags</h2>
<ul>
<li>rm -- -filename</li>
<li> <b>-d</b>: Attempt to remove directories as well as other types of files</li>
<li> <b>-f</b>: Attempt to remove the files without prompting for confirmation, regardless
of the file's permissions. If the file does not exist, do not display a diagnostic message
or modify the exit status to reflect an error.</li>
<li> <b>-i</b>: Request confirmation before attempting to remove each file,
regardless of the file's permissions, or whether or not the standard input device
is a terminal.</li>
<li> <b>-P</b>: Overwrite regular files before deleting them. Files are overwritten
three times, first with the byte pattern 0xff, then 0x00, and then 0xff again, before
they are deleted.</li>
<li> <b>-R</b>: Attempt to remove the file hierarchy rooted in each file argument.
The -R option implies the -d option.
If the -i option is specified, the user is prompted for confirmation before
each directory's contents are processed (as well as before the attempt is
made to remove the directory).
If the user does not respond affirmatively, the file hierarchy rooted in that
directory is skipped.</li>
<li> <b>-r</b>: Same as -R.</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.
Currently, this option can only be used to recover files covered by whiteouts.</li>
</ul>
<p>The same behavior can be obtained by using an absolute or relative path reference. For example:</p>
<ul>
<li>rm /home/user/-filename</li>
<li>rm ./-filename</li>
</ul>
<h>SEE ALSO</h>
<p>rmdir(1), undelete(2), unlink(2), fts(3), getopt(3), symlink(7)</p>
<h2>Removing links</h2>
<h>BUGS</h>
The rm utility removes symbolic links, not the files referenced by the links.<br>
It is not allowed to remove the files "." or "..".<br>
<p>The -P option assumes that the underlying file system is a fixed-block file system.
In addition, only regular files are overwritten, other types of files are not.</p>
When the utility is called as unlink, only one argument, which must not be a directory,
may be supplied. No options may be supplied in this simple mode of operation,
which performs an unlink(2) operation on the passed argument.<br>
<h>COMPATIBILITY</h>
<p>The rm utility differs from historical implementations in that the -f option only masks attempts to remove non-existent files instead of masking a large variety of errors.
The -v option is non-standard and its use in scripts is not recommended.</p>
<p>Also, historical BSD implementations prompted on the standard output, not the standard error output.</p>
<h>STANDARDS</h>
<p>The rm command is almost IEEE Std 1003.2 (``POSIX.2'') compatible, except that POSIX requires rm to act like rmdir(1) when the file specified is a directory.
This implementation requires the -d option if such behavior is desired. This follows the historical behavior of rm with respect to directories.</p>
<p>The simplified unlink command conforms to Version 2 of the Single UNIX Specification (``SUSv2'').</p>
<h>HISTORY</h>
<p>A rm command appeared in Version 1 AT&T UNIX.</p>
The rm utility exits 0 if all of the named files or file hierarchies were removed,
or if the -f option was specified and all of the existing files or file hierarchies were removed.
If an error occurs, rm exits with a value 0.

View File

@ -1,27 +0,0 @@
---
layout: page
category_title: Frontpage
category-page: info
tags: project why goal members organization timeline
author: Matteo Omenetti <br> Frontpage Leader
title: About the project
---
<p>
<img id="TimeLine" src="../../assets/info/Timeline.jpg" alt="Timeline of the project" width="500px"</img>
<p>
This is the final project of the course “Software Atelier 1” hosted by the University of Lugano.
For this project, the informatics students of the first year got divided into two groups, each made up of 25 students.
The goal of this project was to put into practice all the skills obtained during the entire duration of this course: Latex,
HTML, CSS, Unix Shell and SVN. <br>
The students had about 4 weeks to develop, from the ground up, this 100 pages website. A great coordination was needed to develop
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. 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, intermediate and advance section commands.
Each macro section had its own leader, that was responsible for overseeing the conduct of the other team members within his group.
hen each team leader reported back to group leader, that was responsible for the success 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.
</p>
</p>

View File

@ -1,26 +1,23 @@
---
layout: page
category_title: Frontpage
category-title: Frontpage
category-page: info
tags: motivation why important
author: Matteo Omenetti <br> Frontpage Leader
author: Matteo Omenetti
title: Motivation
---
<p>
<p> Why Learning the Unix Shell? <br>
This is the question that you probably asked yourself
the first time you saw someone doing something with it.
the first time you saw someone doing something with it.<br>
Well, Unix Shell is actually a must have skill for any well respectable computer scientist.
There are indeed several reasons to learn using it, here are some: </p>
There are indeed several reasons to learn using it, here are some:
<ul>
<li> It is the only way to communicate with servers, because they dont have a graphical user interface. </li>
<li> You can program in the Shell! Unix Shell provides a set of special commands that can be used to create Scripts.
Scripts are programs that can execute in a loop a series of commands. You can even create scripts that automatically fix your code! </li>
<li> You look like a hacker, when you use it! (If you really want to look like a pro, go to settings and make
the shell background black, with green text.) </li>
<li> It is the only way to communicate with servers, because they dont have a graphical user interface. </li>
<li> You can program in the Shell! Unix Shell provides a set of special commands that can be used to create Scripts.
Scripts are programs that can execute in a loop a series of commands. You can even create scripts that automatically fix your code!</li>
<li> You look like a hacker, when you use it! (If you really want to look like a pro, go to settings and make
the shell background black, with green text.) </li>
</ul>
</p>

View File

@ -0,0 +1,34 @@
---
layout: page
category-title: Frontpage
category-page: info
tags: project why goal members organization timeline
author: Matteo Omenetti
title: About the project
---
<p>
<img id="TimeLine" src="../../assets/info/Timeline.jpg" alt="Timeline of the project" width="500px"</img>
<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>
The goal of this project was to put into practice all the skills obtained during the entire
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>
A great coordination was needed to develop
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>
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,
intermediate and advance section commands.<br>
Each macro section had its own leader, that was responsible for overseeing the conduct
of the other team members within his group.
hen each team leader reported back to group leader, that was responsible for the success
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.
</p>

View File

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h3>Redirecting Outputs</h3>
<p>First of all, to redirect a certain output of the command-line we have to use the symbol ">".</p>
<p>Even in this case, we will use a file named "Hello", in which we want to move a certain output, like "Sun".</p>
<hr>
<p>$ echo Sun > Hello </p>
<p>So if we copy the the file on our command-line, the output will be the following:</p>
<p>$ cat Hello<br>
Sun</p>
<hr>
<br>
<p>If we want to move a certain output to an existing file, we just have to use twice the ">" symbol.</p>
<hr>
<p>$ echo Bright >> Hello</p>
<p>$ cat Hello<br>
Sun<br>
Bright</p>
<hr>
<br>
<h3>Redirecting Inputs</h3>
<p>To redirect an input from a file for a command, you have to use symbol "<".<br>
In fact, it's not useful, as the result that obtain is just the content of the file.</p>
<p>Redirecting inputs becomes useful when it comes to chaining, so let's see it.<p/>
<h3>Chaining</h3>

View File

@ -0,0 +1,55 @@
---
layout: page
category-page: scripts
category-title: Scripting
tags: reditect output input
author: Dario Rasic
title: Redirection
---
<h2>Output as input</h2>
<p>To redirect a certain output of the command-line we have to use the symbol "&gt;".<br>
In this case, we will use a file named "<i>hello.txt</i>", in which we want to insert
a certain output ("Sun" in this case):<br>
<pre>
echo "Sun" > hello.txt
</pre>
So if we print the content of the file in our command-line, the output will be the following:
<pre>
cat hello.txt
Sun
</pre>
If we want to append a certain output to an existing file,
we just have to use "&gt;&gt;" symbols:</p>
<pre>
cat hello.txt
Sun
echo "Moon" >> hello.txt
cat hello.txt
Sun
Moon
</pre>
<h2>Input as output</h2>
To redirect an input from a file for a command, the symbol "&lt;" is used.
<pre>
echo < $(cat hello.txt)
Sun
Moon
</pre>
This is particularly useful when chaining commands.
<h2>Chaining</h2>
<h1>To be completed</h1>
</p>

View File

@ -1,51 +0,0 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!-- Echo command text -->
<h3>Echo</h3>
<p>This command print as output its entire argument on the command-line.<br>
It could be used with variables, like in the following example:</p>
<hr>
<p>$ example:"this is an example"</p>
<br>
<p>$ <b>echo</b> $example</p>
<p>this is an example</p>
<hr>
<br>
<!-- Cat command text -->
<h3>Cat</h3>
<p>This command prints the content of a certain file as an output on the command-line.</p>
<p>As example, we could imagine a simple text file in pages named "Hello", which contains the line "Hello World".<br>
So, our command example will look like this:</p>
<hr>
<p>$ pages Hello</p>
<p>$ <b>cat</b> Hello<br>
Hello World</p>
<hr>
<br>
<!-- Grep command text -->
<h3>Grep</h3>
<p>This one behaves very similarly to the previus one, but in this case it prints only the lines matching a certain pattern.<br>
In this we could imagine a certain text file "animals", which contains a list of animal-names.</p>
<p>If we want to select only the animals whose name begins with the letter "d", we will write this:<br>
<hr>
<p>$ grep d animals<br>
Deer<br>
Dog<br>
Dolphin<br>
...
<br>
<hr>
<br>
</body>
</html>

View File

@ -0,0 +1,5 @@
---
layout: topic
category-page: scripts
title: Scripting
---

View File

@ -11,7 +11,7 @@ author: Claudio Maggioni
"tags" : "{{ page.tags | join: ', ' }}",
"url" : "{{ page.baseurl }}{{ page.url }}",
"date" : "{{ page.date }}",
"category": "{{ page.category_title }}"
"category": "{{ page.category-title }}"
},
{% endif %}
{% endfor %}