[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: A question about bash scripting



Ralf Mardorf <ralf.mardorf@alice-dsl.net> wrote:
> month=$(date +%B)
> mon=$(date +%b)
> d_y_t=$(date '+/%d/%Y %T')
> done=$(date +%s)

You've got a horrible race condition in there just waiting to bite
you. Try this instead:

    done=$(date +%s)
    month=$(date --date @$done +%B)
    mon=$(date --date @$done +%b)
    d_y_t=$(date --date @$done +'/%d/%Y %T')

Chris


Reply to: