2 spelling in the comments..
source | link

If you really want to put it in a variable, you can use a bash array:

#!/bin/bash
FILES=(/home/userA/folder/*.txt)
for i in "${FILES[@]}" # double qouting pervents extra word splitingsplitting
do
    bn="$(basename "$i")" #to# to get the name of the file
    a="/home/userA/folder2/$bn/a_%06d.jpg"
done

Or you can simply use for i in /home/userA/folder/*.txt.

If you really want to put it in a variable, you can use a bash array:

#!/bin/bash
FILES=(/home/userA/folder/*.txt)
for i in "${FILES[@]}" # double qouting pervents extra word spliting
do
    bn="$(basename "$i")" #to get the name of the file
    a="/home/userA/folder2/$bn/a_%06d.jpg"
done

Or you can simply use for i in /home/userA/folder/*.txt.

If you really want to put it in a variable, you can use a bash array:

#!/bin/bash
FILES=(/home/userA/folder/*.txt)
for i in "${FILES[@]}" # double qouting pervents extra word splitting
do
    bn="$(basename "$i")" # to get the name of the file
    a="/home/userA/folder2/$bn/a_%06d.jpg"
done

Or you can simply use for i in /home/userA/folder/*.txt.

1
source | link

If you really want to put it in a variable, you can use a bash array:

#!/bin/bash
FILES=(/home/userA/folder/*.txt)
for i in "${FILES[@]}" # double qouting pervents extra word spliting
do
    bn="$(basename "$i")" #to get the name of the file
    a="/home/userA/folder2/$bn/a_%06d.jpg"
done

Or you can simply use for i in /home/userA/folder/*.txt.