[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $var invokes function?
From: |
Marc Herbert |
Subject: |
Re: $var invokes function? |
Date: |
Mon, 10 Aug 2009 09:24:54 +0100 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090320) |
BuraphaLinux Server a écrit :
> 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.
More direct, but less flexible.
printf "arbitrary date is %s\n" "$(dateFunc)"
dateFunc() { date; } # today
dateFunc() { echo "2009-1-2"; }
dateFunc() { <whatever>; }