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

exec-host does not resolve env variables in commands #1946

Closed
jonaseberle opened this issue Nov 14, 2019 · 0 comments
Closed

exec-host does not resolve env variables in commands #1946

jonaseberle opened this issue Nov 14, 2019 · 0 comments

Comments

@jonaseberle
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
I was trying to add the current user's .gitconfig to .ddev/homeadditions in a pre-start hook.

I expected something like this to work

- exec-host: |
  [ -e ~/.gitconfig ] && cp -L ~/.gitconfig .ddev/homeadditions/

(problems with [ paranthesis)

- exec-host: |
  [[ -e ~/.gitconfig ]] && cp -L ~/.gitconfig .ddev/homeadditions/

bashism anyways, but does not resolve ~ to home user directory

- exec-host: echo ~
- exec-host: echo $HOME

(outputs "~" "$HOME")

Tried running it though bash

- exec-host: bash -c "echo $HOME"

(outputs $HOME": -c: Zeile 0: End of file encountered while looking fo »"«
$HOME": -c: Zeile 1: Syntax error: Unexpected EOF.)

Describe the solution you'd like
It would be nice if the command string in there was just eval'ed without further escaping and the like.

Describe alternatives you've considered
Just run a bash file which does the job. In there you are not restricted.

Additional context
It might be difficult to make that cross-platform - if yes, I suggest adding a line to the documentation with the suggestion to use an external file before building complex commands in there ;)

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