Correctly check current directory and try changing to ~/IOTstack#311
Open
senarvi wants to merge 2 commits intoSensorsIot:masterfrom
Open
Correctly check current directory and try changing to ~/IOTstack#311senarvi wants to merge 2 commits intoSensorsIot:masterfrom
senarvi wants to merge 2 commits intoSensorsIot:masterfrom
Conversation
Slyke
reviewed
May 5, 2021
scripts/backup.sh
Outdated
| 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" |
Collaborator
There was a problem hiding this comment.
cd "$(dirname $(readlink -f $0))/.." Does this work for you instead? Trying not to lock IOTstack to ~/IOTstack
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
backup.shtried 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~/IOTstackif it doesn't exist.