bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: $var invokes function?


From: BuraphaLinux Server
Subject: Re: $var invokes function?
Date: Sat, 8 Aug 2009 17:44:13 +0700

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 <pc88mxer@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

[Prev in Thread] Current Thread [Next in Thread]