
June 2nd, 2004, 02:34 PM
|
|
Contributing User
|
|
Join Date: Jun 2003
Posts: 245
Time spent in forums: 11 m 27 sec
Reputation Power: 6
|
|
|
Interpreting Bash command firstchar=${1:0:1}
Interpreting Bash command firstchar=${1:0:1}
1) What does the code on line 8) firstchar=${1:0:1} do ?
2) $ stand for an argument, but what does {1:0:1} do ?
=========================
Code:
1) if [[ $# -eq 2 ]]
2) then
3) if [[ "$1" != "$2" ]]
4) then
5) exit 1
6) fi
7) else
8) firstchar=${1:0:1}
9) if [[ "$firstchar">"/" && "$firstchar"<":" ]]
10) then
11) exit 2 # username cannot start with a number
12) fi
13) fi
|