Articles

Affichage des articles du septembre, 2012

Développer en BASH

<code> date +FORMAT OR date +"%FORMAT" OR date +"%FORMAT%FORMAT" OR date +"%FORMAT-%FORMAT" $ date +"%m-%d-%y" 02-27-07 $ date +"%m-%d-%Y" $ date +"%D" Display time only $ date +"%T" How do I save time/date format to the shell variable? Simply type the following command at the shell prompt: $ NOW=$(date +"%m-%d-%Y") %FORMAT String Description %% a literal % %a locale's abbreviated weekday name (e.g., Sun) %A locale's full weekday name (e.g., Sunday) %b locale's abbreviated month name (e.g., Jan) %B locale's full month name (e.g., January) %c locale's date and time (e.g., Thu Mar 3 23:05:25 2005) %C century; like %Y, except omit last two digits (e.g., 21) %d day of month (e.g, 01) %D date; same as %m/%d/%y %e day of month, space padded; same as %_d %F full date; same as %Y-%m-%d %g last two digits of year of ISO week number (see %G) %G year of ISO week number (see %V); normally usef