Script Help
am 27.03.2006 05:13:04 von XXdennismu
This is a shell script question but I'm going to use it in my .procmailc when
I get it to work. I'm on a tcsh.
date +%d>date # this produces my file named date with 26 in it
What I would like to do next through a script is rename the file 'date' to
'26' or whatever happens to be in that file on a particular day that its run.
TIA, Dennis
================
Re: Script Help
am 27.03.2006 05:36:00 von Garen Erdoisa
Dennis wrote:
> This is a shell script question but I'm going to use it in my .procmailc when
> I get it to work. I'm on a tcsh.
>
> date +%d>date # this produces my file named date with 26 in it
>
> What I would like to do next through a script is rename the file 'date' to
> '26' or whatever happens to be in that file on a particular day that its run.
>
> TIA, Dennis
> ================
>
In your .procmailrc you can do this:
# Note the backticks around the date command which invokes an
# embedded shell script.
# This will expand to a folder name of the style:
# /home/username/mail/folder.2006Mar
FOLDERNAME=${HOME}/mail/folder.`date +%Y%b`
# save the mail in our date stamped folder.
:0
${FOLDERNAME}
Garen
Re: Script Help
am 27.03.2006 05:47:56 von XXdennismu
In article <122endjhh5pvbc2@corp.supernews.com>, Garen Erdoisa wrote:
===========
>>
>In your .procmailrc you can do this:
>
># Note the backticks around the date command which invokes an
># embedded shell script.
># This will expand to a folder name of the style:
># /home/username/mail/folder.2006Mar
>
>FOLDERNAME=${HOME}/mail/folder.`date +%Y%b`
>
># save the mail in our date stamped folder.
>:0
>${FOLDERNAME}
>
>
>Garen
That works for what you intended Garen. What I really need to start with is to
make a file named whats in the file named 'date'.
Dennis
============
Re: Script Help
am 27.03.2006 06:09:58 von Garen Erdoisa
Dennis wrote:
> In article <122endjhh5pvbc2@corp.supernews.com>, Garen Erdoisa wrote:
> ===========
>> In your .procmailrc you can do this:
>>
>> # Note the backticks around the date command which invokes an
>> # embedded shell script.
>> # This will expand to a folder name of the style:
>> # /home/username/mail/folder.2006Mar
>>
>> FOLDERNAME=${HOME}/mail/folder.`date +%Y%b`
>>
>> # save the mail in our date stamped folder.
>> :0
>> ${FOLDERNAME}
>>
>>
>> Garen
>
> That works for what you intended Garen. What I really need to start with is to
> make a file named whats in the file named 'date'.
>
> Dennis
> ============
Ah, well then something like the following might work.
this example uses bash as the script language. But the technique should
be adapted easily to other script languages.
#!/bin/bash
SOURCEFILENAME='date'
# save the day of month in a file named "date"
date +%d >${SOURCEFILENAME}
# Save the contents of the file "date" into a variable
# note the backticks that launch an embedded shell script.
TARGETFILENAME=`cat ${SOURCEFILENAME}`
# rename the file named "date" to that of the contents of the file
mv date ${TARGETFILENAME}
Re: Script Help
am 27.03.2006 09:31:12 von XXdennismu
In article <122epdahbhi6hb2@corp.supernews.com>, Garen Erdoisa wrote:
>Ah, well then something like the following might work.
>this example uses bash as the script language. But the technique should
>be adapted easily to other script languages.
>
>#!/bin/bash
>SOURCEFILENAME='date'
>
># save the day of month in a file named "date"
>date +%d >${SOURCEFILENAME}
>
># Save the contents of the file "date" into a variable
># note the backticks that launch an embedded shell script.
>TARGETFILENAME=`cat ${SOURCEFILENAME}`
>
># rename the file named "date" to that of the contents of the file
>mv date ${TARGETFILENAME}
Many thanks amigo!!!!!!! This is exactly what I've spent 2 days on. I've
incorporated it into my .procmailrc to move a count file for me at the end of
every month. Thanx again!!!!
Dennis
=========