开发者

busybox shell refuses to execute the particular line of script

I am using busybox shell to execute a script which the bash executes when i boot linux using the nfs. Please let me know the correct alternative for this line.

cur_major=$((0x`stat -c %t $dev开发者_StackOverflow中文版 2>/dev/null`))

The busybox throws in an error saying "0x" syntax error, which i understand is the problem with the syntax of this line.

Thanks in advance


major_hex=`stat -c %t $dev 2>/dev/null`
cur_major=`printf "%2d" 0x"$major_hex"`


I don't have a problem running it. try doing it step by step if all else fails.

$ var=$(stat -c "%t" $dev 2>/dev/null)
$ var=$((0x$var))

actually $(()) lets you perform arithmetic. what is it actually you are trying to do? are you trying to convert to a hex number?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜