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

ensure leading newline when adding lines to shell profile #197

Merged
merged 1 commit into from
Apr 1, 2024
Merged

ensure leading newline when adding lines to shell profile #197

merged 1 commit into from
Apr 1, 2024

Conversation

dy-dx
Copy link
Contributor

@dy-dx dy-dx commented Mar 29, 2024

The install script currently breaks .bash_profile if it doesn't end with a trailing newline.

For example:

ulimit -n 8192

becomes

ulimit -n 8192export DVM_DIR="..."

command echo "export PATH=\"\$DVM_DIR/bin:\$PATH\"" >> "$HOME/$shell_profile"
EXPORT_DVM_DIR="export DVM_DIR=\"$dvm_dir\""
EXPORT_PATH="export PATH=\"\$DVM_DIR/bin:\$PATH\""
command printf "\\n$EXPORT_DVM_DIR\\n$EXPORT_PATH\\n" >> "$HOME/$shell_profile"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose you could do echo -e "\nexport ..." but stackoverflow says printf is more portable (link) 🤷

@justjavac justjavac merged commit a50e7eb into justjavac:main Apr 1, 2024
8 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.

2 participants