In a bash script I have the following:
MES=$(date +"%b")
How can I get the month in english format?
Now if I echo $MES variable, I get abr. But I would like to get apr.
I'm trying to solve this without using if statement or switch. May be is an option...
I have tried date -u
but is not working for me.
EDIT:
Finally I have put this line in the first line of script script:
#!/bin/bash
LANG=en_us_8859_1
# Here rest of the script
Now is working, but I can't accept my own answer as valid... I think because I haven't enough reputation in stackoverflow
Bash Date format YYYY-MM-DD To format date in YYYY-MM-DD format, use the command date +%F or printf "%(%F)T\n" $EPOCHSECONDS . The %F option is an alias for %Y-%m-%d . This format is the ISO 8601 format.
date +%S. Displays seconds [00-59] date +%N. Displays in Nanoseconds. date +%T.
Use
MES=$(LANG=en_us_88591; date +"%b")
to change the language just for this single call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With