Sponsored Content
Top Forums Shell Programming and Scripting meaning of today=${1:-${today}} Post 302612715 by Vidhyaprakash on Monday 26th of March 2012 09:35:14 AM
Old 03-26-2012
meaning of today=${1:-${today}}

what does today=${1:-${today}} mean???

I saw a script which has these two lines:
today=`date '+%y%m%d'`
today=${1:-${today}}

but both gives the same value for $today

Code:
user:/export/home/user>today=`date '+%y%m%d'`
user:/export/home/user>echo $today
120326
user:/export/home/user>today=${1:-${today}}
user:/export/home/user>echo $today
120326
user:/export/home/user>today=
user:/export/home/user>today=${1:-${today}}
user:/export/home/user>echo $today
 
user:/export/home/user>

Can someone please let me know, what actually today=${1:-${today}}
means???
 

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to list today's files

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)
Discussion started by: berlin_germany
4 Replies

2. Shell Programming and Scripting

Grep out only today's date

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)
Discussion started by: horhif
8 Replies

3. What is on Your Mind?

How Would You Like Your Loops Served Today?

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)
Discussion started by: bakunin
8 Replies

4. Shell Programming and Scripting

Check, if date is not today

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)
Discussion started by: bora99
2 Replies
SARG-REPORTS(1) 					      General Commands Manual						   SARG-REPORTS(1)

NAME
sarg-reports - Daily/Weekly/Monthly squid usage reports creation tool SYNOPSIS
sarg-reports [OPTIONS] DESCRIPTION
This manual page documents briefly the sarg-reports command. sarg-reports is a script written to automate the SARG (a powerful squid log analyzer) reports and log management. Sarg it self, provide to end user a generic interface to create reports based on squid access log (begin of log to current date). sarg-reports is useful because it allow you to easly create and manage Daily, Weekly and Monthly reports. OPTIONS
A summary of options is included below. manual Create Manual report today Create Today report daily Create Daily report weekly Create Weely report monthly Create Monthly report CRONTAB
If you want the reports can be generated automatically insert the following lines (the today report creation time depend mostly of your sarg server load average, tune it): PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 00 08-18/1 * * * sarg-reports today 00 00 * * * sarg-reports daily 00 01 * * 1 sarg-reports weekly 30 02 1 * * sarg-reports monthly REMEMBER: if you use logrotate, configure it to rotate the logs within MONTHLY basis, AFTER sarg-reports created the monthly html report. VARIABLES
Check before using the sarg-reports that the following variables are set to file /etc/sarg/sarg.conf SARG The sarg executable location CONFIG The sarg main configuration file location HTMLOUT Location where will be saved the reports PAGETITLE The title of main index page LOGOIMG Image logo to view in main index page LOGOLINK HTTP web page link of logo DAILY Word 'daily' translation, translate it to your language WEEKLY Word 'weekly' translation, translate it to your language MONTHLY Word 'monthly' translation, translate it to your language EXCLUDELOG1 Exclude text from cron emails (normally, sarg, during cron activity, if it don't find any valid records, EXCLUDELOG2 It will output an error message (usually on 'today' reports). I don't want to be warned by email about this, so, i wrote the 'text' that will be never logged. This is useful to receive email of real problems only. AUTHOR
sarg-reports was written by Ugo Viti <ugo.viti@initzero.it> This manual page was written by Juan Angulo Moreno <juan@apuntale.com>, for the Debian project (but may be used by others). may 17, 2008 SARG-REPORTS(1)
All times are GMT -4. The time now is 07:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy