Rajouté la date/heure à ls (options) >> fichier.txt

Salut,

Je peaufine mes alias, un exemple tel que :

je ne souhaite pas écraser le fichier.txt (>>)

Voici ma requête. J’aimerai y insérer la date et heure à chaque fois que je lancerai l’alias. Voir même en tâche cron suivit d’un diff.

Je dirais que ça marche. Après tu peux optimiser le format date avec les différentes options.

Je dirais que ça marche. Après tu peux optimiser le format date avec les différentes options.

Salut,

[quote=“michel_vi”]
Je dirais que ça marche.[/quote]

Tu m’étonnes … c’est parfait! :023

[code]root@pc-2-loreleil:~# date >> /root/Recents/var.www.txt && ls -larth /var/www >> /root/Recents/var.www.txt && cat /root/Recents/var.www.txt

dimanche 3 juin 2012, 09:28:30 (UTC+0200)

total 12K
-rw-r–r-- 1 root root 177 26 avril 15:31 index.html
lrwxrwxrwx 1 root root 23 4 mai 12:50 greensql -> /usr/share/greensql-fw/
drwxr-xr-x 2 root root 4,0K 25 mai 14:57 .
drwxr-xr-x 17 root root 4,0K 2 juin 10:15 …
total 12K
-rw-r–r-- 1 root root 177 26 avril 15:31 index.html
lrwxrwxrwx 1 root root 23 4 mai 12:50 greensql -> /usr/share/greensql-fw/
drwxr-xr-x 2 root root 4,0K 25 mai 14:57 .
drwxr-xr-x 17 root root 4,0K 2 juin 10:15 …
total 12K
-rw-r–r-- 1 root root 177 26 avril 15:31 index.html
lrwxrwxrwx 1 root root 23 4 mai 12:50 greensql -> /usr/share/greensql-fw/
drwxr-xr-x 2 root root 4,0K 25 mai 14:57 .
drwxr-xr-x 17 root root 4,0K 2 juin 10:15 …
total 12K
-rw-r–r-- 1 root root 177 26 avril 15:31 index.html
lrwxrwxrwx 1 root root 23 4 mai 12:50 greensql -> /usr/share/greensql-fw/
drwxr-xr-x 2 root root 4,0K 25 mai 14:57 .
drwxr-xr-x 17 root root 4,0K 2 juin 10:15 …

dimanche 3 juin 2012, 09:30:28 (UTC+0200)

total 12K
-rw-r–r-- 1 root root 177 26 avril 15:31 index.html
lrwxrwxrwx 1 root root 23 4 mai 12:50 greensql -> /usr/share/greensql-fw/
drwxr-xr-x 2 root root 4,0K 25 mai 14:57 .
drwxr-xr-x 17 root root 4,0K 2 juin 10:15 …
root@pc-2-loreleil:~#
[/code]

J’ai de la chance, le man est en fr … :083

Merci michel_vi … :wink:

bah de rien. Je suis en train d’apprendre les commandes et la programmation de scripts bash autant que ça serve.

Salut,

Dis moi, sur quel doc/manuel t’appuies tu ? fr de préférence … :wink:

sur les man en anglais. Car les français contiennent des fois des erreurs. Quand j’ai un doute sur le sens en anglais je regarde le français.