How to? Put logic into an alias...

Aug 2, 2011
258
4
Berlin, Germany
Hi Mathew,

Code:
(system)  C:\TEMP >%@if[%_dow eq Thu,echo have a nice weekend,echo day of week is: %_dow]
day of week is: Fri
 
(system)  C:\TEMP >%@if[%_dow eq Fri,echo have a nice weekend,echo day of week is: %_dow]
have a nice weekend
 
May 24, 2010
855
0
Northlake, Il
Frank, I must have done something wrong (I'm half blind), but @If didn't work for me. So extending it a little bit: can you code the "true" and "false" clauses as a sequence of commands?
 
May 20, 2008
3,520
3
Elkridge, MD, USA
I have many aliases structured thusly:
alias reciprocal=`iff %1 NE 0 then %+ echo %@eval[ 1 / %1] %+ else %+ echo 0 has no reciprocal %+ endiff`

The advantage over @IF is that only the desired branch is executed, the "false" branch can contain expressions causing failure.
 
May 24, 2010
855
0
Northlake, Il
Thank you Steve; somehow I had the idea that IFF couldn't be used in an alias the way you are using it. I obviously should have tried it before making that assumption.