I’m a bash begginer and I want to solve the next problem:
Find all the files in a directory received as command line argument that contain numbers greater than 1000. If the command line doesn’t contain any arguments, display a message and exit.
Firstly I wanted to check only if there is a number equal to 1000, because I don’t know how to check if it’s bigger using grep. This is my code:
#!/bin/bash if [ $0 -eq 0 ] then echo "No arguments" exit 0 fi for filename in $1 do if [ -f filename ] then if grep -q "1000" $filename echo $filename fi fi done
And it raises some errors on line 3 and 15 andI don’t know why.
Can somebody help me,please?