string - How can I split very long case patterns across multiple lines? -


how split long valuex string in following bash code?

case "$1" in     value1|value2|value3|...........more values..................| valuen)         some_processing "$@"         ;;     ... esac 

i'm looking splitting separate lines. m.b. like:

val+=value1 val+=value2 .... 

thanks in advance

from man page:

a case command first expands word, , tries match against each pattern in turn, using same matching rules path‐name expansion[.]

in other words, it's glob pattern, not regular expression. such, can use ifs between pattern tokens. example:

case "$1" in     value1 | \     value2 )         :     ;; esac 

note must escape line continuation backslash, unlike usual case pipe symbol continue line automatically. other that, can break line same way @ prompt.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -