You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多
文档控制台
免费开始使用

Linux bc命令与Bandizip重名,无法使用浮点除法的解决办法

Fixing the 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 bc directly with its absolute path:
    /usr/bin/bc
    
  • For persistent use in your shell: Add an alias to your shell config file (like ~/.bashrc or ~/.zshrc):
    alias bc='/usr/bin/bc'
    
    Then reload the config to apply changes immediately:
    source ~/.bashrc
    
    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.

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:

  1. Find the directory containing Bandizip’s bc (from the which -a bc output, e.g., /opt/bandizip/bin).
  2. Edit your shell config file and add this line to put the system’s bin directory first:
    export PATH="/usr/bin:$PATH"
    
  3. 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:

  1. Find Bandizip’s bc path (e.g., /opt/bandizip/bin/bc).
  2. Rename it with sudo (since it’s likely in a system directory):
    sudo mv /opt/bandizip/bin/bc /opt/bandizip/bin/bzbc
    
  3. Test that Bandizip still works normally (try a simple archive operation with bzbc to 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

火山引擎 最新活动