0

I'm trying to set each element from for loop to var in Bash.

This is my line:

counter=1 ;
for i in $(ls /);
do
    echo line number $counter - $i  ;
    line"$counter"="$i" ;
    echo $(line$counter);
    counter=$[counter+1];
 done

What I am trying to do, is set each i variable to counted vars ($counter).

6

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.