So now what's great some really simple script with a for loop.
So great file in for that as I age and start with siobhán then bash and on next line we can write some
command.
We are building.
So into all text files in the current directory.
And you line the cut and
and first five lines of a second.
So one time or into all text files in the current directory of a new line with the current date and
the first five lines of B-S common.
So now we can create for a loop.
So for a file in elist which is represented by a wildcard asterisk dot text and just for the recap in
wildcard it's asterisk means any number of characters.
So for each text file we need two plays.
Now some commands between do and done keyboards we can start with printing the current date but because
date is a command we need to command substitution and wrap it inside parentheses and then the output
when we need to read it to textfile represented by variable file added action is done using greater
than symbol.
But there is good to mention that Sinko great that dense himbo would rewrite content of a file by our
output and we want to own at your output to a file we need to use double grade den symbol.
Now redirect five lines of B-S command and to specify first five lines.
I am using head Desch 5
and it is basically done
but for better readability I will print a few equal signs into next command and also read it next to
a file.
Now you can save the file
Grant with permission
and I can check using ls command that I don't have any text files here so I will create files on both
text files to the text.
And also I can create file sutee without any extensions.
Now we can then descript and check out of file one.
Great.
Date and five lines from commom for being sure that the script is working fine.
I can check for three
and can see that it is empty.
Great.
Now we can nondescript again.
And if we check files to for example
we see two outputs added here.
Great.