在 Ubuntu 中,当我尝试将十六进制 (ZZZZZ) 转换为 3777777 时。
如果从 A 到 F,它应该显示自十六进制以来的错误,对吗?
DESKTOP-DQWCSON:~$ echo 'ibase=16; obase=8; ZZZZZ' |bc
3777777
最佳答案
因为这不是错误。从 bc 手册页:
Single digit numbers always have the value of the digit regardless of the value of ibase. (i.e. A = 10.) For multi-digit numbers, bc changes all input digits greater or equal to ibase to the value of ibase-1.
可以将其视为
bc
中的设计流程。 ,但它的行为与记录的一样。
关于linux - 在 ubuntu bash 脚本中,当我尝试转换错误的十六进制值时不会抛出任何错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69672248/