[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Fildatoer og strenge i bash



On Fri, 17 Mar 2006 23:08:19 +0100
Jens Bang <sslug@sslug> wrote:

> On Thursday 16 March 2006 13:31, bjuhn wrote:
> > sslug@sslug ~ $ let a=`stat --format=%y <filnavn> | cut -d '-' -f 1`
> > sslug@sslug ~ $ echo $a
> > 2006
> 
> Og det virker.  :-)
> 
> Tak for det.
> 
> Men nu til en udvidelse:
> 
> Jeg vil gerne opbygge en streng der ser sådan ud:
> 
>      Noget tekst, DD.MM.YYYY HH:MM - (C) Jens Bang YYYY
> 
> Er det muligt i bash? Eller er det nu jeg skal sige til mig selv, at
> det ikke længere er en scripting opgave, og så bare skrive skidtet i
> C?
> 
> Det jeg er ude efter, er at få fildatoen fra et JPEG billede, og så
> bruge det til at opbygge en copyright streng (som den ovenfor), som
> jeg så kan bruge i et kald til convert, som en form for vandmærke af
> billedet.
> 

For at være rigtig "træls" så vil jeg nok bruge Date kommandoen i
stedet for og så gøre det i stil med:

echo "Noget tekst, `date -r <filnavn> +'%d.%m.%Y %H:%M'` - (C) Jens
Bang `date +%Y`"


Et eksempel i et simpelt bash script kunne være:

#!/bin/sh
filtekst="Noget tekst, `date -r $1 +'%d.%m.%Y %H:%M'` - (C) Jens Bang
`date +%Y`"
echo $filtekst


Mvh
Jesper K. Pedersen


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-04-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *