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

Scripts better error messages #759

Merged
merged 2 commits into from
Nov 4, 2021
Merged

Conversation

EricClaeys
Copy link
Collaborator

No description provided.

This is the same as what Chris did for endOfNight.sh
This eliminates the need to duplicate the command - on for the command line and the other for the error message.
@linuxkidd
Copy link
Collaborator

linuxkidd commented Nov 4, 2021

What's the value of pipe'n $CMD to bash? Does it give any benefit over just running $CMD ? imo, it just costs the resources of spawning another bash session.

e.g.

	CMD="'${ALLSKY_HOME}/keogram' ${SIZE_FILTER} -d '${DATE_DIR}' -e ${EXTENSION} -o '${UPLOAD_FILE}' ${KEOGRAM_EXTRA_PARAMETERS}"
	${CMD}
	RETCODE=$?

@EricClaeys
Copy link
Collaborator Author

EricClaeys commented Nov 4, 2021

Just running ${CMD} fails since there are single quotes in the variable and they are passed to keogram, so, for example, the directory becomes '/home/pi/allsky/images/20211102' instead of /home/pi/allsky/images/20211102.
KEOGRAM_EXTRA_PARAMETERS contains quotes around the font color values, e.g., --font-color '255 255 255' because we need the three numbers to be passed as one argument to the keogram program.
This is the same reason the allsky.sh program uses bash arrays for the arguments, to make sure arguments with spaces are not interpreted as multiple arguments.

@linuxkidd linuxkidd merged commit 8639ae1 into master Nov 4, 2021
@EricClaeys EricClaeys deleted the scripts-better-error-messages branch November 4, 2021 00:56
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.

None yet

2 participants