combine python function with for loops in bash terminal -


i aimed open multiple files (one one, using loop in bash terminal) , modify using plink (a programme) , later on, python function. following codes:

for in {1..10};   plink --cow --noweb --lfile $i --extract extract1.snp --recode --out 1$i   python -c 'import file_convert;file_convert.convert_tree_mix("1$i.map","tmp$i")' done 

but, expected, python not read , not open "11.map", did not replace "$i" 1. how can modify code python function, in combination loop, open different file each time based on value of "i"

you need include whole python code inside double quotes, $1 inside python code expand. $1 in shell refers first parameter.

python -c "import file_convert;file_convert.convert_tree_mix(\"1$i.map\",\"tmp$i\")" 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -