head -$4 $5 > temp
head -$2 $3 | tail -n +$1 >> temp
tail -n +$(expr $4 +1) $5>> temp
This is a problem using head and tail. I need a description of each line please thank!
head -$4 $5 > temp
head -$2 $3 | tail -n +$1 >> temp
tail -n +$(expr $4 +1) $5>> temp
This is a problem using head and tail. I need a description of each line please thank!
$2, $3, $4 and $5 are all command line arguments called positional parameters.
Line 1:
Reads the first n lines [represented by $4, a positional parameter] in a file [represented by $5, another positional parameter] and creates a file called "temp" with the output.
Line 2:
Reads the first n lines [represented by $2, a positional parameter] in a file [represented by $3, another positional parameter], then reads the last n lines of that command and appends the output to the "temp" file.
Line 3:
Reads the last n number of lines, where n is equal to ($4 + 1) in a file [represented by $5, yet another positional parameter] and appends the output to the "temp" file.