Skip to content
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

The style, the code, etc. #1

Open
ashevche opened this issue Apr 12, 2023 · 0 comments
Open

The style, the code, etc. #1

ashevche opened this issue Apr 12, 2023 · 0 comments

Comments

@ashevche
Copy link

It seems like the script doesn't keep a single style, has a lot of redundancy, etc.
E.g.,

if [ ! -d "$FOO" ]; then
  mkdir -p "$FOO"
fi

First of all this can be written as

[ -d "$FOO" ] || mkdir -p "$FOO"

but hey, the -p is exactly to avoid this all, and hence

mkdir -p "$FOO"

is enough.

Next one, cat ... | grep. Google for "useless use of cat", it is a very old idiom in UNIX to avoid unnecessary forks of processes that are not needed at all.

Last, but not least, change shebang to #!/bin/sh -efu and fix all issues with the script. It will get more portability and robustness.

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