Adb Shell Regular Expression Doesn't Work As Tested Locally
First, sorry if my question is obscure or in an inconvenient format. This is my first post here :D. My issue is that I have a script, let's say test.sh which reads an input, and va
Solution 1:
The default shell in Android is mksh
. It is not 100% compatible with bash
. So do not expect all bash
recipes to work without changes.
For the description of features supported by mksh
- read its manual page.
Solution 2:
This is a GNU bash POSIX regular expression. In Korn Shell, you can use extglob regular expressions to the same effect:
if[[ $num = ?(-)+([0-9]) ]]; then
…
See the section “File name patterns” in the manpage for details.
Solution 3:
I had to use ksh expression as shown below to get this to work.
case$numin
+([0-9])*(.)*([0-9]) )
# Variable positive integerecho"positive integer"
;;
*)
# Not a positive integerecho"NOPE"exit
;;
esac
Post a Comment for "Adb Shell Regular Expression Doesn't Work As Tested Locally"