So -n expects the number of lines. If you're not giving it a number of lines, don't bother telling head -n.
You're improperly nesting your if's. If you want to do if/else, use elif. Or you could break it into two completely separate if-statements. And you still have the useless ;'s there.
And the 'return' still doesn't do anything like what you think it does. It doesn't jump to the top of the script. To loop, you need a loop.
The first argument is $1. So ls -l $1. There's another argument you can give ls to reverse its order, which you can find via man ls.
You can tell how many arguments there are with the $# special variable. Something like if [ "$#" -eq 2 ] to do one thing when you have two arguments, and another when you don't.
You can redirect into a file with >. command > filename
so
is going to do this step?:
I dont know how to use
to redirecte all of this results above:
to the 2nd argument, because it is in the program, its not like outside the program. i did
and then what should I do?
also, what can I do with the 2nd question?:
got no idea
Hi,
I want to write a script which will tail a particular file for 15 mins and then sleep for 10 mins and again tail for 15 mins. This cycle will go on for a limited period of time.
How can i ensure that tail command will run for 15 mins before calling sleep command
Thanks (6 Replies)
I have a script that runs every hour from the crontab (see the settings of the crontab below) (15 mins past the hour)
15 * * * * /home/usr/usr1/ProvAll
This script saves two files in the following format
now=`/bin/date '+%Y%m%d.%H%M%S'`
file1.$now (for example)
file1.20140722.031502... (12 Replies)
I need 5 mins old logs to be dumped into a a new file.
The date formats in the two log files are
Can you suggect for both formats ?
bash-3.2$ uname -a
SunOS myserver 5.10 Generic_150400-26 sun4v sparc sun4v
---------- Post updated 05-04-16 at 12:24 AM ---------- Previous update was... (2 Replies)
Hi,
system date format
Thu Jun 13 12:55:18 EDT 2019
My log date format
09.148.192.60 - - "GET /akamai/sureroute-test-object.html HTTP/1.1" 404 231
can someone please help me, how to get last 5mins of logs please ? I need the command
Please wrap your samples/codes in CODE TAGS,... (3 Replies)