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 <pc88m...@gmail.com> wrote:
>
> Hi,
>
> Is it possible to create a variable whose value is determined by a function?
>
> Silly example: somehow define $today to return the output of /bin/date
>
> and that way one can write: echo today is $today
>
> Thanks,
>
>
> --
> View this message in context:
> http://www.nabble.com/%24var-invokes-function--tp24870314p24870314.html
> Sent from the Gnu - Bash mailing list archive at Nabble.com.
>
>
>
>


Reply via email to