In Linux, many people don't understand the meaning of the variable parameter $ in the script, $0, $1. . . . . . What do you mean by each? The following small series will give you a detailed introduction to the meaning of the Linux variable parameter $, interested friends may wish to understand.
Let's write a simple script, to explain the significance of each variable after the execution # touch variable # vi variable script reads as follows: #! /bin/shecho “number:$#”
echo “scname:$0”
echo “first :$1”
echo “second :$2”
echo “argume:$@”
echo “show parm list:$*”
echo “show process id:$ $”
echo “show precomm stat: $? ”
Save Exit Give script execution permission # chmod +x variable Execute script # . /variable aa bbnumber:2
scname:. /variable
first:aa
second:bb
argume:aa bbshow parm list:aa bb
show process id:24544show precomm stat:0
By showing the results you can see: $# is the number of arguments passed to the script $0 is the name of the script itself $1 is the first argument passed to the shell script $2 is the first passed to the shell script The two parameters $@ are a list of all the parameters passed to the script. $* displays all the parameters passed to the script as a single string. Unlike the position variable, the parameter can exceed 9 months. The current process ID number of the script is running. $? Is to display the exit status of the last command, 0 means no error, others indicate an error
The above is the introduction of the meaning of the Linux variable parameter $, it can be seen that the variable parameter $ plus the number represents different in the script Meaning, how do you learn how to use the variable parameter $?
After Debian mounts the mobile hard disk, some partitions will be recognized, and some partitions wi
The PPA repository is a software depot designed for Ubuntu users and is easier to u
The NTP server under Linux refers to the network time synchronization protocol, whi
We all know that the Linux rm command can delete files, but if you want to delete the directory, you
How to encrypt emails under Linux?
Linux offline query dictionary method
Do you know the 7 major trends in the Linux desktop space?
Kali Linux crack wifi password with what software is good?
Linux use pass to manage passwords
How to deal with the disappearance of ibus input method icon after upgrading Ubuntu 12.04?
How to partition Linux VPS system disk?
How to upgrade OpenSSH under Linux system?
How to install Eclipse and PyDev extensions in Ubuntu 14.04?
Linux system file permissions and access mode introduction
What should I do if Ubuntu fails to adjust and save the screen brightness?
How to Record Video with KK Recorder KK Recorder Recording Video Tutorial
Win10 system how to open the Chinese version of Cortana
Win9 will be equipped with a one-click upgrade function
The user finally breathed a sigh of relief: Microsoft stopped Win10 forced upgrade
Delete delete command that cannot delete files
Win10 Build 10532 released 64-bit Chrome program crashes at startup
Win7 extended C disk partition problem
USB0 can not be used after Win7 restart
After upgrading to Win10 official version, the sound is gone. Solution
Some of the new features and features of Windows 8 revealed in the slide