I'm trying to output the date and time, in a different time zone, in a bash shell script. Following this question, I did this:
#!/usr/bin/env bash
IL=":Asia/Jerusalem" date "+%a %b %d %R"
echo "Israel: $IL"
which outputs this:
Wed Jun 19 15:12
Israel:
Not only is the time incorrect for that time zone, but the output is incorrectly displayed on two lines.
I'd like it to output this:
Israel: Wed Jun 19 23:12
In other scripts, where the default time zone is fine (for example, in my .xinitrc
to display the current system time), I've done:
date_str="$(date +"%a %b %d %R")";
topbar="Time: $date_str";
xsetroot -name "$top_bar";
What am I doing wrong this time?