According to this answer ...
A command is split into an array of strings named arguments. Argument 0 is (normally) the command name, argument 1, the first element following the command, and so on.
$ ls -la /tmp /var/tmp arg0 = ls arg1 = -la arg2 = /tmp arg3 = /var/tmp
Would it be possible to print out each argument ... let say with echo.
I've been using echo $@ and echo $0 $1 $2 $3 right after executing ls -la /tmp /var/tmp command but didn't really work.
I also tried this without > /dev/null but didn't work as well. (I'm getting exactly similar output as below)
user@linux:~$ ls -la /tmp /var/tmp > /dev/null
user@linux:~$ echo $@
user@linux:~$
user@linux:~$ ls -la /tmp /var/tmp > /dev/null
user@linux:~$ echo $0
bash
user@linux:~$
user@linux:~$ ls -la /tmp /var/tmp > /dev/null
user@linux:~$ echo $1
user@linux:~$
user@linux:~$ ls -la /tmp /var/tmp > /dev/null
user@linux:~$ echo $0 $1 $2 $3
bash
user@linux:~$
Desired Output
I'm expecting to see the following output on my terminal screen after executing ls -la /tmp /var/tmp
Input
ls -la /tmp /var/tmp
Output
arg0 = ls
arg1 = -la
arg2 = /tmp
arg3 = /var/tmp