开发者

busybox shell refuses to execute the particular line of script

开发者 https://www.devze.com 2022-12-27 03:19 出处:网络
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.

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

精彩评论

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

关注公众号