Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: defining real time variables for a shell



On Mar 20,  9:09pm, Eric Smith - Fruitcom wrote:
}
} }   > elif [[ $cmd[1] == [\(\)0-9]* ]]; then
} }   >     application=calc
} }   > ( I think you wrote that one for me :) )
} 
} Yeah, when I have a moment, I will write how I apply this command line
} "mailcap" to most things I do.

I think you did already:  zsh-users/6463 ?

} }   > '(15/$GBP)+(3750/1900)'
} }   
} }   Just get rid of the $ sign -- it's not necessary in math context
} }   
} }   	'(15/GBP)+(3750/1900)'
} 
} Huh?  the GBP is a var, how can a bare string be interpolated.
} [eric@pepper ~] $ "(15/GBP)+(3750/1900)"
} "GBP" is undefined

Um, what's the application "calc"?

When you said "my arithmatic on the command line" I assumed you were
using zsh's built-in arithmetic, in which bare strings are treated as
variable references.

E.g.,

schaefer[509] calc() { print $(( $* )) }
schaefer[510] GBP=1.44
schaefer[511] calc '(15/GBP)+(3750/1900)'
11.416666666666668



Messages sorted by: Reverse Date, Date, Thread, Author