If a parameter is given along with a script name while invoking it, then that parameter is considered, otherwise 'today' would contain `date +%y%m%d`.
For e.g., consider this script:
While invoking it, if you provide a parameter then variable 'today' would contain that parameter:
If you invoked the script without any parameters, then variable 'today' would hold today's date:
This User Gave Thanks to balajesuri For This Post:
hello,
in a file exist entries in date format YYYYMMDD. i want to find out, if there are dates, which isn't today's date.
file:
date example text
20140714 <= not today's date
20140715 <= not today's date
20140716 <= today's date
my idea is to use Perderabo's datecalc
... (2 Replies)
Scrutinizer and i had a discussion about loops in shell scripts and you might be interested in joining in and share your experiences:
i wrote an example script which basically employed the following logic:
cat /some/file | while read var ; do
echo var = $var # just do... (8 Replies)
Hi,
I have some log files. I've been asked to grep out error messages that have happened ONLY today. (However, the logs keep messages a long time so they have error messages going back weeks)
They log details in these fields (order):
Month Day Time Server message
I can grep out the... (8 Replies)
Hi,
I am trying to list names of only today's files OR say, files which are not older than 1 hour and copy them in 'list.txt' file. I know,
:ls > list.txt will list all the files. But, how to list today's files? Any help will be appriciated. (4 Replies)