created special script variables page
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@173 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
parent
64ecc4e6c3
commit
0b33641558
1 changed files with 36 additions and 0 deletions
36
site/pages/scripts/special_variables.html
Normal file
36
site/pages/scripts/special_variables.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
layout: page
|
||||
category-page: scripts
|
||||
category-title: Scripting
|
||||
tags: variables, special, $, !
|
||||
author: Dario Rasic
|
||||
title: Script Special Variables
|
||||
---
|
||||
<!-- Intro -->
|
||||
<p>
|
||||
As previously said, there are certain characters that we can not use in the variable-naming process.
|
||||
<br>
|
||||
In this page we will see what actually are those characters, and what's their purpose.
|
||||
<br>
|
||||
<!-- list of commands-->
|
||||
<h4>$$</h4>
|
||||
To begin, we will see the simplest variable, which is the dollar sign ($). This command simply gives us the process ID number of the current shell.<br>
|
||||
|
||||
<pre>
|
||||
echo $$
|
||||
11480
|
||||
</pre>
|
||||
|
||||
<h4>$0</h4>
|
||||
This variable will simply give us the filename of the current script.
|
||||
|
||||
<h4>$n</h4>
|
||||
This variable corresponds to the arguments with which a script was invoked. Here n is a positive number corresponding to the position of an argument.
|
||||
|
||||
<h4>$#</h4>
|
||||
This variable gives us the number of arguments supplied to a script.
|
||||
|
||||
<h4>$!</h4>
|
||||
This variable gives us the process number of the last background command.
|
||||
|
||||
</p>
|
Loading…
Reference in a new issue