First shell script--helloworld
[Email protected] ~]# VI sh01.sh#!/bin/bash #! Indicates which shell# this is my first shell script #注释部分echo-E "Hello world!" Exit 0[[email protected]~]# SH sh01.sh # execute SH file Hello world! using bash or SH command
Second shell script--Receives user input from the terminal into the variable
Third shell script--Create a new file from the terminal receiving user input file name
The date command +%y%m%d is a parameter, and the argument after the command is preceded by a minus sign, and in some cases, preceded by a plus ' + ' case
In a string of commands, you also need to provide information through other commands, which can be used with the "inverted single quote or $ ()
Execute SH sh03.sh
Fourth shell script---numeric operation
The numeric operations in the shell script only support integer operations; the variables in the shell script default to Strings , so if you want variables to perform numeric operations, there are two ways to do this: • The first is to use $ ((numeric expression)), such as $ ( first+ $last))• The second declares a variable as Integer: declare–i total= Numeric Expression sum=$ (($first + $second))
Linux08--shell Programming the shell script