Skip to content

Collection of ideas #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tomschr opened this issue Sep 27, 2022 · 0 comments
Open

Collection of ideas #2

tomschr opened this issue Sep 27, 2022 · 0 comments

Comments

@tomschr
Copy link

tomschr commented Sep 27, 2022

Hi Dima,

great script! Love it! ❤️

I have some suggestion and ideas, maybe you would like to consider them:

  • I used shellcheck (package ShellCheck) as it checks for warnings, code smells etc. I can highly recommend it as Frank uses it for daps as well.

  • In the usage() function you use $0. This is certainly possible, but if $0 contains a path it will also show in the output. That can make the output ugly and a bit unreadable. I'd recommend to always add an additional line to create the base name of the script:

      # Basename of the script
      ME="${0##*/}"
    

    In the usage() function use $ME instead of $0.

  • In line 107 you write to /tmp with a fixed filename. That can be dangerous as it can be abused ("man in the middle" attacks?). I'd recommend to use random filenames created by mktemp.

  • Maybe a minor thing, but config files are defined by the XDG Base Directory specification. It's from the Free Desktop initiative. User directories are stored in $HOME/.config.
    If you want to consider it, you could check for $HOME/.otto.cfg and $HOME/.config/otto/otto.cfg and load whatever is available. If you really want to adhere to the spec, you could also check the XDG_CONFIG_HOME environment variable. I know, more code, but also more flexible.

  • Using the cd command is possible, but if you want to change directories back and forth, maybe look also for the built-in commands pushd and popd.

Keep up the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant