case passthru

Bastian Bittorf bittorf at bluebottle.com
Thu Feb 18 16:17:37 UTC 2016


* David Henderson <dhenderson at digital-pipe.com> [18.02.2016 17:14]:
> case "$(cat /tmp/md5.txt)" in
>     '123456')
>         ...implement updates for this particular version...
>         ;;
>     '234567')
>         ...implement updates for this particular version...
>         ;;
> esac

this is not POSIX and you can work around with e.g.:

#!/bin/sh
while read -r CRC; do
  case "$CRC" in
    '1234')
      ...
    ;;
    '5678')
      ...
    ;;
  esac
done </tmp/md5.txt

bye, bastian


More information about the busybox mailing list