I am looping over the commands with for i in {1..n} loop and want output files to have n extension.
For example:
for i in {1..2} do cat FILE > ${i}_output done However n is user's input:
echo 'Please enter n' read number for i in {1.."$number"} do commands > ${i}_output done Loop rolls over n times - this works fine, but my output looks like this {1..n}_output.
How can I name my files in such loop?
Edit
Also tried this
for i in {1.."$number"} do k=`echo ${n} | tr -d '}' | cut -d "." -f 3` commands > ${k}_output done But it's not working.