mbucc / shmig

Database migration tool written in BASH.
BSD 3-Clause "New" or "Revised" License
461 stars 50 forks source link

Doesn't work in ash (Alpine's default shell) #23

Open mbucc opened 7 years ago

mbucc commented 7 years ago

Bash doesn't come on Alpine by default, so:

bbox:~/src/shmig$ ./shmig -h
-ash: ./shmig: not found

Tried changing shebang to #!/bin/sh, but that failed with:

./shmig: line 169: syntax error: unexpected "(" (expecting "}")

which refers to

bbox:~/src/shmig$ grep -n ^ shmig | grep -C 3 169:
166:
167:  "${TYPE}_cli" "$show" | grep -F -qx "$SCHEMA_TABLE"
168:
169:  local status=("${PIPESTATUS[@]}")
170:
171:  [[ ${status[0]} -ne 0 ]] && return 1
172:
mbucc commented 7 years ago

Quick fix: apk add bash

mbucc commented 7 years ago

The <<< redirection with sqlite_cli also fails.

# sqlite3 -bail -batch  elmarelli-api.db <<< 'select name from sqlite_master'
-ash: syntax error: unexpected redirection
#