Hi I keep having trouble with this
echo 'Welcome to my first Script'
mkdir myScript
cd myScript
touch doc1 sales.doc.test2.txt outline.doc
echo 'You now have ' ;find . -type f|wc -l;echo 'files in your "myScript" folder'
address="205"
echo -n "Please enter your favourite number:"
read myvar
echo "The number you entered is $myvar"
I'm trying to make the output say "You now have (3) files in your myScript folder" as one line, but it keeps outputting them on 3 seperate lines. I've tried 3 or 4 different codes here (by clicking the similar questions above) but they give me funny errors and this is just my first script, so I understand all the commands I'm using (minus the calculation for files, I had to google that one).
echo "You now have $(find . -type f|wc -l ) files in your \"myScript\" folder"
Additionally, I'd recommend altering the find
to include -maxdepth 1
, otherwise you'll recurse...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With