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

Expand $HOME directory shorthand ~ (tilde character) to absolute path #14

Open
DJviolin opened this issue Aug 9, 2022 · 0 comments
Open

Comments

@DJviolin
Copy link

DJviolin commented Aug 9, 2022

Is your feature request related to a problem? Please describe.

I'm using shdotenv in a special Laradock project structure, where I merge Laradock's and my environment variables into one:

eval "$($DIR/shdotenv --dialect docker --overload --env laradock.env.example || echo "exit $?")"
set -a && . ./.env && set +a

However, shdotenv cannot expand the tilde character, if I put the value in quote or not, doesn't matter:

eval "$($DIR/shdotenv --dialect posix --overload --env .env || echo "exit $?")"

Output I'm getting:

APACHE_SSL_PATH=~/.laradock/ssl/apache2

Expected output:

APACHE_SSL_PATH=/home/user/.laradock/ssl/apache2

Describe the solution you'd like

It would be nice to have a flag, where it can expand $HOME shorthand (~) to absolute paths.

Describe alternatives you've considered

The only working solution is to use the good old bash env variable parsing trick:

set -a && . ./.env && set +a

But with this, I loose every control over the file and I have to format it very carefully. It works with my files, but not with the ones from various repositories.

Additional context

None.

@DJviolin DJviolin changed the title Expand Home directory shorthand ~ (tilde character) to absolute path Expand $home directory shorthand ~ (tilde character) to absolute path Aug 9, 2022
@DJviolin DJviolin changed the title Expand $home directory shorthand ~ (tilde character) to absolute path Expand $HOME directory shorthand ~ (tilde character) to absolute path Aug 9, 2022
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

No branches or pull requests

1 participant