* trouble setting shell variable
@ 2002-05-26 14:07 Jim Reimer - WA5RRH
2002-05-26 15:11 ` G Anna
2002-05-26 15:58 ` Suriya Narayanan M S
0 siblings, 2 replies; 4+ messages in thread
From: Jim Reimer - WA5RRH @ 2002-05-26 14:07 UTC (permalink / raw)
To: linux-newbie
I'm trying to rename files based on what time it is *now*....
echo `date` | cut -b 25-28,12-13,15-16,18-19
gives me what I want to use for the file name, but I
can't figure out how to get it into a variable for use
later in the script when I rename the file. I've tried
variablename=
followed by the above commands surrounded by quotes,
parenthesis, back tics, etc. - all produce syntax errors.
Somebody point me in the right direction.
Thanks,
-jdr-
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: trouble setting shell variable
2002-05-26 14:07 trouble setting shell variable Jim Reimer - WA5RRH
@ 2002-05-26 15:11 ` G Anna
2002-05-26 15:58 ` Suriya Narayanan M S
1 sibling, 0 replies; 4+ messages in thread
From: G Anna @ 2002-05-26 15:11 UTC (permalink / raw)
To: Jim Reimer - WA5RRH; +Cc: linux-newbie
> Date: Sun, 26 May 2002 09:07:10 -0500
> From: Jim Reimer - WA5RRH <wa5rrh@arrl.net>
> Subj: trouble setting shell variable
>
> I'm trying to rename files based on what time it is *now*....
>
> echo `date` | cut -b 25-28,12-13,15-16,18-19
Why are you echoing? Simply pass the output of date to cut.
> gives me what I want to use for the file name, but I
> can't figure out how to get it into a variable for use
> later in the script when I rename the file. I've tried
>
> variablename=
$ b=`date | cut -b 25-28,12-13,15-16,18-19`
$ echo $b
2038422002
$
HTHs
anna
--
(14) The hero is not entitled to a last kiss, a last cigarette, or any
other form of last request. - Peter Anspach in "The Top 100 Things
I'd Do If I Ever Became An Evil Overlord"
http://www.eviloverlord.com
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: trouble setting shell variable
2002-05-26 14:07 trouble setting shell variable Jim Reimer - WA5RRH
2002-05-26 15:11 ` G Anna
@ 2002-05-26 15:58 ` Suriya Narayanan M S
2002-05-26 16:44 ` Jim Reimer - WA5RRH
1 sibling, 1 reply; 4+ messages in thread
From: Suriya Narayanan M S @ 2002-05-26 15:58 UTC (permalink / raw)
To: Jim Reimer - WA5RRH; +Cc: linux-newbie
On Sunday 26 May 2002 7:37 pm, Jim Reimer - WA5RRH wrote:
> echo `date` | cut -b 25-28,12-13,15-16,18-19
>
> gives me what I want to use for the file name, but I
> can't figure out how to get it into a variable for use
> later in the script when I rename the file. I've tried
>
> variablename=
$ variablename=`echo \`date\` | cut -b 25-28,12-13,15-16,18-19`
$ vim ${variablename}
or
$ variablename=`date | cut -b 25-28,12-13,15-16,18-19`
$ vim ${variablename}
To make life simple use the formatting available with date.
eg.
$ variablename=`date +%d-%b-%Y`
$ echo ${variablename}
26-May-2002
Hope that answers your question.
Bye,
Suriya Narayanan M S
--
Guru Brahma Gurur Vishnu
Gurur Dhevo Maheshwaraha
Gurur Saakshaath Parabramha
Thasmai Shree Gurave Namaha
Public key at www.keyserver.net
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: trouble setting shell variable
2002-05-26 15:58 ` Suriya Narayanan M S
@ 2002-05-26 16:44 ` Jim Reimer - WA5RRH
0 siblings, 0 replies; 4+ messages in thread
From: Jim Reimer - WA5RRH @ 2002-05-26 16:44 UTC (permalink / raw)
To: mssnlayam; +Cc: linux-newbie
forgot about formatting.... that makes it a LOT easier.
thanks.
On Sunday 26 May 2002 10:58 am, Suriya Narayanan M S wrote:
> On Sunday 26 May 2002 7:37 pm, Jim Reimer - WA5RRH wrote:
> > echo `date` | cut -b 25-28,12-13,15-16,18-19
> >
> > gives me what I want to use for the file name, but I
> > can't figure out how to get it into a variable for use
> > later in the script when I rename the file. I've tried
> >
> > variablename=
>
> $ variablename=`echo \`date\` | cut -b 25-28,12-13,15-16,18-19`
> $ vim ${variablename}
>
> or
>
> $ variablename=`date | cut -b 25-28,12-13,15-16,18-19`
> $ vim ${variablename}
>
> To make life simple use the formatting available with date.
> eg.
> $ variablename=`date +%d-%b-%Y`
> $ echo ${variablename}
> 26-May-2002
>
> Hope that answers your question.
> Bye,
> Suriya Narayanan M S
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-05-26 16:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-26 14:07 trouble setting shell variable Jim Reimer - WA5RRH
2002-05-26 15:11 ` G Anna
2002-05-26 15:58 ` Suriya Narayanan M S
2002-05-26 16:44 ` Jim Reimer - WA5RRH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.