Hello LBP74, welcome to LQ,
your shift command decrements the number of arguments. And this are your linenumbers, decremented from 4 down to 1.
You could as an alternative set a variable which you increment in each step of the loop.
this would work:
Code:
#!/bin/bash
a=1
while [ "$#" -ne 0 ]; do
echo "$a":$1
let a=a+1
shift
done
Markus