Issue
I'm new in bash scripting and I'm trying to create a bash script which can create multiple file with content (around 10000 lines [no matters what text]) but with user input. I made a script which create files (see below) but how can I fill each file with 10000 lines? Thank you in advance!
#!/bin/bash
echo How many files do you want to create?
read numberOfFiles
echo
echo Please enter the files name with should start:
read nameForFiles
echo
for i in $(seq 1 $numberOfFiles)
do
touch $nameForFiles-$i.txt
done
Solution
Replace your touch
command with this:
for ((j=0; j<9999; j++)); do echo "Cyrus was here"; done > "$nameForFiles-$i.txt"
Answered By - Cyrus Answer Checked By - David Goodson (WPSolving Volunteer)