hello,
i have a variable which should have following content :
var="value1"
or
var="value2"
or
var="value2:[digit][digit]*" # example: value2:22
how can i check :
- if the content is ok (value1 / value2* )
- the two options of "value2"
when content is example "value2:22" , i want to split it in "part1" and "part2" , like "value2", "22". for spliting i will use "awk"
is is possible to do this with "case" (with ERE) ?
case "${var}" in
"value1" ) ...
value2* ) case "${var}" in
value2 ) ...
value2:* ) ...
...
esac
split :
echo ${var}" | awk -F":" '{ print $1, $2 }' | read part1 part2
regards