I tried to check my variable value with case statement and regular expression in sh
script like the following code:
#!/bin/sh
test="test.1.testing"
case $test in
test.[5-9]+.testing) echo "value type 1";;
test.[1-4]+.testing) echo "value type 2";;
esac
This script doesn't work, have any solution with sh
script (not bash
)
I changed the symbol "+"
by "*"
and the script run succesfully, but I need to test with "+"
(for 1 or more occurrence)
#!/bin/sh
test="test.1.testing"
case $test in
test.[5-9]*.testing) echo "value type 1";;
test.[1-4]*.testing) echo "value type 2";;
esac