finished coding in bash, seems to work