Skip to content

Collection of ideas #2

@tomschr

Description

@tomschr

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions