Linux-shell First Lesson
1, through a small example to introduce the shell
#! /bin/sh Call Sehll
echo Print content read input cd jump directory pwd View current directory
650) this.width=650; "title=" 1.jpg "src=" https://s5.51cto.com/wyfs02/M00/8D/EA/ Wkiol1ivmfixitxkaaaulf37ymw005.jpg-wh_500x0-wm_3-wmp_4-s_1085938692.jpg "alt=" Wkiol1ivmfixitxkaaaulf37ymw005.jpg-wh_50 "/>
2, define two variables, and find a fit.
A=5
B=6
c=$ (($a + $b))
Echo $c
3, define the variable, and the value of the variable plus 5.
D=9
Let "d+=5"
Echo $d
4. Calling functions
Func1 ()
{
num=105;
Echo $num
}
Func2 ()
{
Local num=13//setting locals
Echo $num
}
Func1
Func2
5. Define function and delete function
Hello ()
{
echo "hello,world!"
}
Hello
Unset-f Hello//delete function
Hello
6. Transmission parameters
#!/bin/sh
Tesfunc ()
{
echo "$# total delivery of $ #个值"
echo "value is: [Email protected]"
}
Tesfunc a b c d E F
#!/bin/sh
Tesfunc ()
{
echo "$# total delivery of $ #个值"
echo "value is: [Email protected]"
echo "The third parameter is $ three"
echo "$?" The last command exits the status as 0 normal "
}
Tesfunc a b c d E F
This article is from the "2722951" blog, please be sure to keep this source http://2732951.blog.51cto.com/2722951/1901033
Linux-shell First Lesson