Scripting: accessing a variable stored in a variable?
ok,
I don't know how many args are going to be input for this script. so I want to do a while loop. the counter <= MAX I'm trying to get what is stored in $1, $2, etc. filename=$"$count" Thanks, Tom |
Hi,
If you use bash, $# holds the amount of parameters given. Man bash fordetails. This is also true for ksh. Hope this helps. |
Thanks,
that's half. I want a while count <= $# do ls $$count done you could write a case for $1 to $9 but ... does that make sense? |
Quote:
|
There are a number of ways to loop over arguments
Code:
while [[ -n $1 ]]; do Code:
for arg in $@; do Code:
for i in {1..$#}; do |
Code:
#!/bin/bash |
All times are GMT -5. The time now is 08:44 AM. |