Protect what matters – even after you're gone. Make a plan for your digital legacy today.
Forum Discussion
Former Member
4 years agoCan't op run a sourced bash function
$ op run --env-file=$HOME/.config/op/aws/$AWS_PROFILE -- jhdev docker ecr-login
[ERROR] 2022/07/07 13:32:00 error while starting process: exec: "jhdev": executable file not found in $PATH
An...
Former Member
4 years agoHey @jhellma1 ,
Thank you for reaching out to us!
I think there are a couple of issues here:
* the library that we use for interpreting and running the commands passed to op run doesn't delegate calling commands to a shell, but calls the commands itself, hence it doesn't have the context of functions/aliases defined in the calling shell's profile
* even if they were to do op run -- $SHELL -c <their command> (which circumvents the problem above) , shell functions are not exported to subshells, since, in general, they aren't meant to be used like this
However, in bash, there's a workaround for this, since functions can actually be exported.
Here's a toy example of how this would work:
bash
function myFunction() { echo "hey there"; }
export -f myFunction
op run -- /bin/bash -c myFunction
Let us know if this helps. Looking forward to hearing from you!
Best,
Horia