I have to put in a bash variable the first line of a file. I guess it is with the grep command, but it is any way to restrict the number of lines?
to read first line using bash, use read statement. eg
read
read -r firstline
firstline will be your variable (No need to assign to another)
firstline