Linux Shell Script 輸入參數
[root@server tmp13]$ view newTest2.sh
#!/bin/bash
# file name
echo "how many: $#"
echo "file: $0"
# Input argument
echo "first argument input: $1"
echo "second argument input: $2"
[root@server tmp13]$ sh newTest2.sh
how many: 0
file: newTest2.sh
first argument input:
second argument input:
[root@server tmp13]$ sh newTest2.sh no1 no2 no3
how many: 3
file: newTest2.sh
first argument input: no1
second argument input: no2