bash stuff, from simple to way overkill