My code
#!/bin/sh
major=$(awk '$2=="module_dev" {print $1}' /proc/devices)
echo $major
mknod /dev/module_dev c $major 0
I'm practicing character device drivers, and this is one of the examples. The code above is ought to create a device driver file at /dev/ but there's an error that says
mknod: missing operand after '0'(it could be wrong because it's just a translation)
for more information type 'mknod --help'
This message was shown when I tried to create a device driver file (sh ***.h)
I have no idea what the problem is. (insmod is already done)
                        
The most likely cause of this error is that
$majorhas no value. That is,$majoris blank.You have the echo statement there: what does it show? If you don't see anything, you might want to enhance it to show nothing enlightenlingly;
which will produce something like
if all is well, and show empty quotes if it is working like I suspect.