Hi everyone, i have to do a little script that search files that contains a string, and print the name of thoose files on the screen. Also, it must allow the user to see only the x first or last results. The script is already done and works well, but it is giving a strange message when asking only for the first x results.
For this cas i use this command:
Code:
find /usr/include/ -name "*" -print | xargs grep -s -l $1 | head -n $3
so when i run
Code:
./script.sh class + 3
to get the 3 first results i get this:
Code:
/usr/include/awk/regex.h
/usr/include/awk/regex_internal.h
/usr/include/net/route.h
xargs: grep: terminated by signal 13
Does anyone know what i have to do so that the xargs message doensn't appear?
It seems it happens cause head ends the grep process.
Well, thanks in advance.