All HowTo's Scripting in Bash

Quick Bash Tip – Creating Test Files

Need some test files sure you could use the below method:

touch file{"1","2","3"}

But why do that when you could just let bash do the work for you and use the following:

touch file{1..100}

I don’t want blank files to test with, they need to have some data in them.. Easy, just make sure you are in the directory with your test files and run the below command.

for i in *; do echo "This is data" >> $i; done

Leave a Reply

Your email address will not be published. Required fields are marked *