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

Correctly check current directory and try changing to ~/IOTstack #311

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

senarvi
Copy link

@senarvi senarvi commented Apr 8, 2021

backup.sh tried to check whether it's run from the IOTstack directory, but used -d (directory exists operator). This small pull request changes it to ! -f (file does not exist) and also tries changing the current directory to ~/IOTstack if it doesn't exist.

echo "./menu.sh file was not found. Ensure that you are running this from IOTstack's directory."
exit 1
if [ ! -f "menu.sh" ]; then
cd "$HOME/IOTstack"
Copy link
Collaborator

Choose a reason for hiding this comment

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

cd "$(dirname $(readlink -f $0))/.." Does this work for you instead? Trying not to lock IOTstack to ~/IOTstack

Copy link
Author

Choose a reason for hiding this comment

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

Sorry for taking some time to reply @Slyke . It's of course a lot better to avoid hardcoding the IOTstack directory. I did something similar that I think should also work in the unlikely case that the path contains spaces.

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