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>; }




Reply via email to