$ date +%Y-%m-%d
2000-08-29

$ date +%Y-%m-%d_%H-%M-%S
2000-08-29_16-38-10

pour plus sur date:
$ man date

script: tag_it.sh
----------------------------------------
#!/bin/sh

mydate=`date +%Y-%m-%d_%H-%M-%S`
mv $1 $1$mydate
----------------------------------------


-- 
Claude Iyi Dogan

On Tue, 29 Aug 2000, Arnaud Vandyck wrote:

> Bonjour,
> 
> J'aimerais cr�er un petit bash qui me copie un fichier en ajoutant la date
> et l'heure avant de compiler:
> -> j'aimerais pouvoir cr�er une variable qui contiendrait une cha�ne de
> caract�re, imm�diatement suivie d'une date au format (jjmmaaaaHHMMSS) suivi
> d'une cha�ne de caract�re pour le suffixe du fichier
> j'ai regard� dans le man de date et j'ai trouv� mon bonheur, mais je ne sais
> pas comment assigner une variable dans le bash (une variable qui
> contiendrait les valeurs d�crites ci-dessus :)
> 
> Merci :)
> --
> Arnaud Vandyck
> STE-Formations Informatiques
> Val Beno�t, ULg, Belgique
> 
> 
> [ If you want to be deleted from the list, send a mail to          ]
> [ [EMAIL PROTECTED] with "signoff linux" in the body.    ]
> [ http://LinuxBe.Org                   Contact: [EMAIL PROTECTED] ]
> 


[ If you want to be deleted from the list, send a mail to          ]
[ [EMAIL PROTECTED] with "signoff linux" in the body.    ]
[ http://LinuxBe.Org                   Contact: [EMAIL PROTECTED] ]

Répondre à