I search for a moment the way in my script bash, to be able to remove the 3 last lines of a file with each call of the script.
test.sh
head -n -3 test.txt > temp.txt ; mv temp.txt test.txt
result :
head: illegal line count -- -3
test.txt - Before:
Name : Mike
Surname : Tilmen
-----------------------------------
Name : Mould
Surname : Tilmen
-----------------------------------
Name : May
Surname : Tilmen
-----------------------------------
test.txt - After (not working):
Name : Mike
Surname : Tilmen
-----------------------------------
Name : Mould
Surname : Tilmen
-----------------------------------