Print variables
[Email protected] shell]# echo $PATH/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Custom variables
[[email protected] shell]# a=1 custom variable [[email protected] shell]# echo $a print variable 1
Write a script for user interaction
[[email protected] shell]# vim 2.sh#!/bin/bash### #read-P "Please input a number:" Number interaction is with Read-pecho $number [[EMA Il protected] shell]# sh 2.shplease input a number:1212
Wait five seconds to automatically exit without executing
[Email protected] shell]# vim 2.sh#!/bin/bash### #read-t 5-p "Please input a number:" Numberecho $number [email protect Ed] shell]# sh 2.sh Five seconds will automatically exit please input a number:[[email protected] shell]#
Mathematical operations
[[email protected] shell]# a=1;b=2[[email protected] shell]# c=$[$a + $b][[email protected] shell]# echo $c 3
Built-in variables
[Email protected] shell]# vim 3.sh#!/bin/bash### #echo "\$1=$1" echo "\$2=$2" echo "\$3=$3" [[email protected] shell]# SH 3. Sh$1=$2=$3=[[email protected] shell]# sh 3.sh 11 22 33$1=11$2=22$3=33
This article is from "Linux rookie" blog, please be sure to keep this source http://490617581.blog.51cto.com/11186315/1764413
Shell Custom Variables