[KLUG Members] url encode in a bash script: solution for RH 9

bill members@kalamazoolinux.org
Thu, 27 May 2004 10:35:00 -0400


Ah, I found a solution, at least for for RH9.

I tracked down on the KLUG site Dirk Bartley's LINUX scripting 
presentation from a few months ago.  By rewriting his awk script on p.14 
of the pdf file I can do this:

stat somefile.txt | awk '/Modify:/{print $2}'

And, by golly, it gives me the date just like I wanted it.

2004-05-20

But, on a Linux 7.3 box, it gives me:

Thu

It appears the output of stat is different on the two OSes.  Is stat 
output a configurable option?

kind regards,

bill

bill wrote:

> I appreciate the link, but I can't read the script.  It looks like it 
> requires a file instead of a variable, and I'm not sure how to include 
> an outside script in the current script.
> 
> Maybe I'm making things too complicated.  I simply want to get the date 
> of a local file from within a bash script.  I was thinking of capturing 
> the output of stat and sending it off to parse elsewhere.  The output of 
> stat has spaces, etc., so it needs to be urlencoded before sending.  If 
> I could get just the date, which is already in the format of YYYY-MM-DD, 
> I could send that off as-is.
> 
> kind regards,
> 
> bill
> 
> Adam Tauno WIlliams wrote:
> 
>> On Wed, 2004-05-26 at 19:51, bill wrote:
>>
>>> I need to url encode some data so I can send it as a POST request 
>>> from a bash script.  Is there some easy way to do that?
>>
>>
>>
>> http://www.shelldorado.com/scripts/cmds/urlencode.txt
>>
>> _______________________________________________
>> Members mailing list
>> Members@kalamazoolinux.org
>> 
>>
>>
> 
> _______________________________________________
> Members mailing list
> Members@kalamazoolinux.org
> 
> 
>