[ale] bash question

Fletch fletch at phydeaux.org
Mon Jul 7 13:53:50 EDT 2003


>>>>> "Christopher" == Christopher Bergeron <christopher at bergeron.com> writes:

[...]

    Christopher> if [ `date +%Y%m%d` -eq `cat datefile.txt` ]; then
    Christopher> echo They match!  else echo They dont match!  fi

    Christopher> but that doesn't seem to work.  Can anyone give me
    Christopher> any pointers on how I can accomplish this?


Seems to work for me ( $() is just another name for `` that nests a
bit nicer):


% echo 20030705 > zorch
% if [[ $( date +%Y%m%d ) -eq $( cat zorch ) ]] ; then echo match ;
else echo no match ; fi
no match
% date +%Y%m%d > zorch
% cat zorch
20030707
% !if
if [[ $( date +%Y%m%d ) -eq $( cat zorch ) ]] ; then echo match ; else
echo no match ; fi
match
% echo $BASH_VERSION
2.05b.0(1)-release


Works just fine in zsh as well.


-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
770 294-0820 (m)      |  scary questions." -- Jules                =(___)=
                      |                                               U
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list