I’m new in shell scripting. How can I write a shell script that shows just the content of the files with more than 8 lines from the current directory (in Ubuntu)?
I know that I must use the command
head and take a
for that goes through all the files and also a counter that will increase every time when a file have more than 8 lines, but something is going wrong. When I execute the script, this doesn’t produce the output it is supposed to produce.
#!/bin/bash for fis in * do cat $fis head -8 $fis done contor=0 while [ contor -le 100 ] do echo $contor contor=`expr $contor + 1` done