I would like to convert a bash array like echo ${b[*]} that outputs something like 1 10 100 1000 to a list format in Python: [1, 10, 100, 1000] that can be ready to use by a Python program. I need to do the conversion in a bash script.
I was doing it with for and if checking the positions, but wondering if there's something cleaner. Thx.
1 10 100 1000to a python script, parse it as a string, andsplit()it into a list, if that helps../your-script.py "${b[@]}"and then readsys.argvin python?