bash: Add extract function

Based on: https://github.com/xvoland/Extract