theshell.ch/site/pages/scripts/0-base-commands.html
bevilj af40908294 order pages for navigation
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@254 a672b425-5310-4d7a-af5c-997e18724b81
2018-11-18 20:38:56 +00:00

55 lines
1.2 KiB
HTML

---
layout: page
category-page: scripts
category-title: Scripting
tags: command base echo cat grep
author: Dario Rasic
title: Script Base Commands
next-page: pages/scripts/1-variables.html
---
<!-- 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:<br>
<pre>
example="this is an example"
echo $example
this is an example
</pre>
<!-- Cat command text -->
<h3>Cat</h3>
This command prints the content of a certain file as an output on the
command-line.<br>
As example, we could imagine a simple text file in nano named "Hello", which contains
the line "Hello World".<br>
So, our command example will look like this:<br>
<pre>
nano Hello
cat Hello
Hello World
</pre>
<!-- Grep command text -->
<h3>Grep</h3>
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.
If we want to select only the animals whose name begins with the letter "d", we will write this:<br>
<pre>
grep "D" animals
Deer
Dragon
Dinosaur
Dog
Dolphin
</pre>