Ash数学运算

来源:互联网 发布:js toggle 切换状态 编辑:程序博客网 时间:2024/06/06 04:09
> -----Original Message-----> From: busybox-bounces at mail.busybox.net > [mailto:busybox-bounces at mail.busybox.net] On Behalf Of Aizer > Danny-BDA023> Sent: Monday, January 17, 2005 07:34> To: BusyBox (E-mail)> Subject: [BusyBox] BusyBox ash arithmetic operations> > Hello,> > I was trying to find out whether BusyBox supports simple arithmetic> operations with variables.Well, it depends on which shell you use, as BusyBox containsfour different shells. Ash supports it, and I think msh does too.If you use ash, then you should enable CONFIG_ASH_MATH_SUPPORTto get arithmetic support.The syntax for the arithmetic expressions follow the standard posix shell (IEEE 1003.1) arithmetic syntax (i.e., the same as bash uses).> E.g., something like:> > wc1=`wc -l file1`> wc2=`wc -l file2`> > total=$wc1 + $wc2?????total=$(( $wc1 + $wc2 ))> if [ $total > MAX_WC ]; thenif [ $total -gt MAX_WC ]; then> echo "squeak"> fi> > If it does not support such operations, is there any "workaround"?> > Thanks,> /Danny//Peter
0 0
原创粉丝点击