Problem Statement
How can you pass and access command-line arguments in a shell script?
Explanation
Arguments are passed after the script name and accessed using positional parameters like $1, $2, and so on.
$0 refers to the script name, and $# gives the total count of arguments.
Code Solution
SolutionRead Only
echo 'First argument:' $1 echo 'Total args:' $#
Practice Sets
This question appears in the following practice sets: