This is the script
user@linux:~$ cat script.sh
#!/bin/bash
for i in `seq $#`
do
echo $i
done
user@linux:~$
Output
user@linux:~$ ./script.sh a b c
1
2
3
user@linux:~$
Desired Output
I would like to get argument value like this .... and not just the number
user@linux:~$ ./script.sh a b c
1 - a
2 - b
3 - c
user@linux:~$
bash
tag, but gave your script a.sh
extension, and the syntax of the file looks more likezsh
(because of the unquoted variable expansions). Which is it? – Stéphane Chazelas Jul 04 '19 at 05:59It's
– Jul 04 '19 at 09:29/bin/bash
. I've updated my script above with shebang