Command Arguments
We can also read user input from command arguments, just like any other programming language. We can then use these arguments in our scripts as $1, $2, and so on, depending on the number of arguments we have provided. Create a file’ arguments.sh’ and copy the below lines in it.
[adimulamvenkat19851609@cxln4 ~]$ cat>hello.sh
#!/bin/bash
echo "Total arguments : $#"
echo "Username: $1"
echo "Age: $2"
echo "Full Name: $3"
[adimulamvenkat19851609@cxln4 ~]$ sh hello.sh tuts 30 'Foss Linux' Total arguments : 3 Username: tuts Age: 30 Full Name: Foss Linux