Skip to content

Conversation

@superpuffin
Copy link

Shift is unecessary here, since we are already picking the first argument (i.e. $1 instead of $0, which would be the command).

Shift is unecessary here, since we are already picking the first argument (i.e. $1 instead of $0, which would be the command).
@anmolbhat
Copy link

Yes, shift causes error when running the script.
If you provide
1> NO Arguments -- Shift Error -- No usage displayed
2> {--install} -- Shows usage instead of installing it --you have to do {--install} twice to get it to work.

No args: "$# = 0" → shift ⇒ error
initial $1=--install → shift drops it → run "$@" sees empty args → falls into usage

This needs to be approved. Pls.

Copy link

@anmolbhat anmolbhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No args: "$# = 0" → shift ⇒ error
initial $1=--install → shift drops it → run "$@" sees empty args → falls into usage

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

Successfully merging this pull request may close these issues.

2 participants