A Bash script accepting command line arguments utilizes special variables: $0, $1, etc. Here’s a simple example:
#!/bin/bash
echo "Script Name: $0"
echo "First Argument: $1"
echo "Second Argument: $2"
In this script, $0 is the script name itself and $1, $2 are the first and second arguments respectively. To handle an arbitrary number of arguments, use “$@” or “$*”. The former treats each quoted argument as separate while the latter considers all as one.