A strange bash script
head -n file > ! pp
What does this line mean ? I am puzzled...
Well, I can break it down a bit...
"head" prints out (usually) the first ten lines of a file. So, "head file1" would print the ten lines in the file named file1. You can modify the number of lines printed with "-n #". "head -n 22 file1" would print out the first 22 lines of the file named file1. Your script line seems to be missing the # after -n.
The ">" redirects the output of the command before it. If takes the output of the head command and sends it somewhere other than the screen. It's usually to a file. "head -n 22 file > file2" would write the first 22 lines of the file named file1 into the file named file2.
I don't know what the exclamation mark is for... It's usually used as a "not" in a conditional when you are comparing two items. "if a != b" means "if a does not equal b". Although in Bash it would be "if [a -ne b];". It prob'ly means something in the Bourne shell. The first line, "#!/bin/sh", calls the Bourne shell. If it was calling Bash, it would be "#!/bin/bash".
The pp might be another program or script that is using the print out from head, or it might be a file that the print out is going into.
Well it does seem a bit strange just seeing part of it. The number of lines to be displayed is missing where it should be -n 5 or some other number. The output of head is redirected to !pp and !pp is the last command in history which started with pp
So it would look like this... head -n 5 somefile > !pp
|All times are GMT -5. The time now is 12:55 PM.|