I recently switched to zsh
. When I was using bash
, I used to use echo 2*3 |bc
as a powerful and convenient calculator but in zsh
the first part of the command result in error message:
$ echo 2*3
zsh: no matches found: 2*3
I know I can avoid the expansion by adding quote to the string 2*3
but is it possible to bring this feature from bash
(not expanding asterisk in command argument)?
UPDATE:
In the meaning while I found bc <<< 2*3
won't trigger the expansion, weird :-(
You can do:
noglob echo 2*3 | bc
And then create an alias around this:
calc()
{
echo $* | bc
}
alias calc='noglob calc'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With