Hi Vlastimil. I used indices because I need the i-th argument and also the i+1-th argument at the same time. shift throws away earlier arguments. There might be a way to refactor it, which I would love to see.
I use exit codes to indicate the status of the method -- i.e. 0 if everything went fine, 1 if there was an error, etc. I also use echo to print strings meant to be "returned" from the functions. See above!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
An alternative to the for loop is the while loop with the shift command. It is without indexes and much simpler.
BTW: This script look like in Java. Bash is not Java, Bash is different. Use echo for return values from function.
Hi Vlastimil. I used indices because I need the i-th argument and also the i+1-th argument at the same time.
shift
throws away earlier arguments. There might be a way to refactor it, which I would love to see.I use exit codes to indicate the status of the method -- i.e.
0
if everything went fine,1
if there was an error, etc. I also useecho
to print strings meant to be "returned" from the functions. See above!