bin: improve binfiles

- Extracted out some functions from fish into more portable scripts based
on bash.
- Fixed and unified the code style in scripts.
- Improved the mux command (old t)