Читать книгу Kali Linux Penetration Testing Bible - Gus Khawaja - Страница 71
TIP
ОглавлениеIf you want to know the number of parameters supplied in the script, then you can use the $#
to get the total. Based on the preceding example, the $#
will be equal to three since we're passing three arguments.
If you add the following line after the printf
line:
printf "%s %d\n" "The total number of params =" $#
you should see the following in the terminal window:
root@kali:~# simpleadd.sh 2 4 4 ######################## The total is = 10 The total number of params = 3 ########################