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

fix: update.sh adds multiple lines to supports.sh #155 #156

Merged
merged 3 commits into from Mar 18, 2024

Conversation

bladerunner2020
Copy link
Contributor

The issue in update.sh was due $ is treated as address and means end of file in this line:

do_sed $"s|'${node_version}'|'${node_version}'\\n	elif [[ \"\$1\" == ${new_meteor_version} ]]; then node_version='${new_node_version}'|" ./support.sh

As sed works line by line there is no simple way to tell sed use the latest occurrence in the file (well at least I didn't find that). So my approach is a bit complicated but works well:

  • reverse file and replace node version with a temporary string
  • reverse file back and then reverse temporary string with what we need

-ap

@bladerunner2020 bladerunner2020 mentioned this pull request Mar 17, 2024
# Reverse the file from filename or stdin
do_tac () {
if [ "$(uname)" == "Darwin" ]; then # Mac
# macOS doesn't have tac, so we use tail -r
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't Linux have tail? So we could just use tail everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't Linux have tail? So we could just use tail everywhere?

There is no -r option on linux (checked on ubuntu):

root@fe890b91bb61:/# tail -r test.txt
tail: invalid option -- 'r'
Try 'tail --help' for more information.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, that’s fine. Can you update the comment then to explain that macOS doesn’t have tac and Linux doesn’t have tail -r, hence the two approaches. Thanks for testing both.

Also please fix the whitespace on many of these lines; this repo uses tabs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@GeoffreyBooth GeoffreyBooth merged commit bf4189c into disney:main Mar 18, 2024
48 checks passed
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