Thread: Suggestions
View Single Post
Old 10-03-2005   #7
hotdog003's Avatar

This may sound like the stuff from page 5, but it's different. Trust me...

fork exp cmdtru cmdfls

It may look rather funky at first glance, but it's actually quite simple. Here's what it would look like in C:
if (exp) {
} else {
exp: Expression. Thing to evaluate, such as 1+1=2
cmdtru: Aliased command to execute if the expression is true
cmdfls: Aliased command to execute if the expression is false

Consider the following:
alias "ctru" "echo 5 + 5 < 20! Yeah!"
alias "cfls" "echo 5 + 5 > 20. How strange!"
fork 5+5<20 ctru cfls
Or this:
alias "ctru" "echo Get rings!!"
alias "cfls"
fork rings>5 ctur cfls
The first one should always print out '5 + 5 < 20! Yeah!', and the seccond one will tell you to get more rings if you have less then five. Very usefull.
hotdog003 is offline   Reply With Quote