Feb 1, 2007 #1 Yarka Technical User Jan 14, 2007 192 ES Hi, I've a trouble when I execute : if [ [ ${a}%5 = 0 && ${b}%10 = 1 ] ]; then How can I do this? Thanks.
Hi, I've a trouble when I execute : if [ [ ${a}%5 = 0 && ${b}%10 = 1 ] ]; then How can I do this? Thanks.
Feb 1, 2007 1 #2 PHV MIS Nov 8, 2002 53,708 FR What about this ? if [[ $((a%5)) = 0 && $((b%10)) = 1 ]]; then Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
What about this ? if [[ $((a%5)) = 0 && $((b%10)) = 1 ]]; then Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
Feb 1, 2007 Thread starter #3 Yarka Technical User Jan 14, 2007 192 ES Hi, In fact, I want to do something as: cat $1 | while read LINE; do read LINE a=`echo "$LINE" | awk -F'\t' '{ print $5 }'` a=${a:3:2} if [[ $((a%5)) = 0 && $((a%10)) = 1 ]]; then ..... echo "if case" else ..... echo "else case" fi done But this check is wrong, because for example if a=25 my output is else case and not if case. Thanks. Upvote 0 Downvote
Hi, In fact, I want to do something as: cat $1 | while read LINE; do read LINE a=`echo "$LINE" | awk -F'\t' '{ print $5 }'` a=${a:3:2} if [[ $((a%5)) = 0 && $((a%10)) = 1 ]]; then ..... echo "if case" else ..... echo "else case" fi done But this check is wrong, because for example if a=25 my output is else case and not if case. Thanks.
Feb 1, 2007 #4 PHV MIS Nov 8, 2002 53,708 FR if [[ $((a%5)) -eq 0 && $((a%10)) -ne 0 ]]; then Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
if [[ $((a%5)) -eq 0 && $((a%10)) -ne 0 ]]; then Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
Feb 1, 2007 Thread starter #5 Yarka Technical User Jan 14, 2007 192 ES This works well, but sorry, if I want to do he negation of the expression: if [[ $((a%5)) -eq 0 && $((a%10)) -ne 0 ]]; then How can I do this? Thanks. Upvote 0 Downvote
This works well, but sorry, if I want to do he negation of the expression: if [[ $((a%5)) -eq 0 && $((a%10)) -ne 0 ]]; then How can I do this? Thanks.
Feb 1, 2007 #6 PHV MIS Nov 8, 2002 53,708 FR Either: if [[ ! ($((a%5)) -eq 0 && $((a%10)) -ne 0) ]]; then or: if [[ $((a%5)) -ne 0 || $((a%10)) -eq 0 ]]; then Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
Either: if [[ ! ($((a%5)) -eq 0 && $((a%10)) -ne 0) ]]; then or: if [[ $((a%5)) -ne 0 || $((a%10)) -eq 0 ]]; then Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886