Linux bc命令与Bandizip重名,无法使用浮点除法的解决办法
bc Command Conflict with Bandizip Hey there, I’ve dealt with this exact path priority issue before—no need to rewrite all your scripts or uninstall Bandizip. Here are three reliable solutions to get the original bc calculator tool working again:
1. Use the absolute path to the original bc
First, find where your system’s real bc is located. Run this command to list all instances of bc in your PATH:
which -a bc
You’ll see output like this (the first entry is the one being picked up now, which is Bandizip’s):
/path/to/bandizip/bin/bc /usr/bin/bc
- For one-off use: Just call the original
bcdirectly with its absolute path:/usr/bin/bc - For persistent use in your shell: Add an alias to your shell config file (like
~/.bashrcor~/.zshrc):
Then reload the config to apply changes immediately:alias bc='/usr/bin/bc'
Note: If your scripts don’t recognize aliases, either update the scripts to use the absolute path, or add the alias line at the top of each script.source ~/.bashrc
2. Adjust your PATH to prioritize the original bc
The root problem is that Bandizip’s bin directory comes before the system’s bin directory in your PATH. Fix this by reordering the PATH:
- Find the directory containing Bandizip’s
bc(from thewhich -a bcoutput, e.g.,/opt/bandizip/bin). - Edit your shell config file and add this line to put the system’s
bindirectory first:export PATH="/usr/bin:$PATH" - Reload the config:
source ~/.bashrc
Now when you run bc, the system will find the original calculator tool first.
3. Rename Bandizip’s bc executable
If you don’t use Bandizip’s command-line bc tool directly, you can safely rename it to avoid the conflict:
- Find Bandizip’s
bcpath (e.g.,/opt/bandizip/bin/bc). - Rename it with sudo (since it’s likely in a system directory):
sudo mv /opt/bandizip/bin/bc /opt/bandizip/bin/bzbc - Test that Bandizip still works normally (try a simple archive operation with
bzbcto confirm).
This way, typing bc will always call the original calculator, and you can still use Bandizip’s command-line tool with the new name bzbc.
内容的提问来源于stack exchange,提问作者jiale ko




