2 Replaced the non portable time format specification by a POSIX one.
source | link

Here is a more robust and portable (POSIX) way to do it, i.e.particularly one that allows for %% to stay unprocessed as an argument:

echo_time() {
    date +"%R+"%H:%M $(printf "%s " "$@" | sed 's/%/%%/g')"
}

Here is a more robust way to do it, i.e. one that allows for % to stay unprocessed as an argument:

echo_time() {
    date +"%R $(printf "%s " "$@" | sed 's/%/%%/g')"
}

Here is a more robust and portable (POSIX) way to do it, particularly one that allows for % to stay unprocessed as an argument:

echo_time() {
    date +"%H:%M $(printf "%s " "$@" | sed 's/%/%%/g')"
}
1
source | link

Here is a more robust way to do it, i.e. one that allows for % to stay unprocessed as an argument:

echo_time() {
    date +"%R $(printf "%s " "$@" | sed 's/%/%%/g')"
}