bash

Get rid of "warning: command substitution: ignored null byte in input"


I'm getting -bash: warning: command substitution: ignored null byte in input when I run model=$(cat /proc/device-tree/model)

bash --version
GNU bash, version 4.4.12(1)-release (arm-unknown-linux-gnueabihf)

With bash version 4.3.30 it's all OK

I understand the problem is the terminating \0 character in the file, but how can I suppress this stupid message? My whole script is messed up since I'm on bash 4.4


Solution

  • There are two possible behaviors you might want here: