Not exactly what you asked for, but works the same:
#! /bin/bash
today() {
date
}
printf "today is %s\n" "$(today)"
exit 0
It is easier to just use $(date) directly though.
On 8/8/09, jscripter wrote:
>
> Hi,
>
> Is it possible to create a variable whose value is determined by a function?
>
(Using 4.0.28(2)-release on Linux and 4.0.24(0)-release on FreeBSD.)
Given this script:
delay=0
read -sn1 v
read -sn1 -t "$delay" w
read -sn1 -t "$delay" x
if I press the up arrow, which generates '\e[A', I would have
expected $w to contain '[' and $x to contain 'A'. However