genv icon indicating copy to clipboard operation
genv copied to clipboard

zsh error

Open dvolgyes opened this issue 2 years ago • 5 comments

Hi,

Great project. I started to play with it, and seems to work well in bash, but it fails immediately in Zsh.

> genv activate                     
_genv_backup_env:2: bad substitution

Probably you used a bash-specific idiom which doesn't work in Zsh.

As a generic advice, maybe running shellcheck could give you improvement ideas: https://github.com/koalaman/shellcheck

dvolgyes avatar Nov 30 '22 10:11 dvolgyes

Hi @dvolgyes and thanks for pointing it out!

We are aware of this issue. This is because of the way we create some of the environment variables and especially because we use ! in parameter substitution here which is supported in bash but not in zsh where it's (P) instead.

For now, Genv officially supports only bash, and supporting more shells is for sure a task that needs to be done. Also, zsh is probably the first one to add support to.

I have some poc of zsh support. I will see if I can make it work, I will create a branch and update you so that you could git checkout this branch and try it yourself.

What I recommend you is to use bash in the meantime and you can do it by running exec bash for example.

razrotenberg avatar Nov 30 '22 15:11 razrotenberg

Hi again @dvolgyes !

I published the branch with zsh support (feature/zsh). I want to test it better before merging it to master.

Until then, you should checkout this branch in order to work with your zsh setup. To do this, open your terminal and run the following:

cd ~/genv
git pull
git checkout feature/zsh

You should probably restart your shell for it to take effect.

It'd be great if you could use it in your zsh setup and provide feedback if it works properly or if something is not working right 🙃

razrotenberg avatar Nov 30 '22 15:11 razrotenberg

Hi @razrotenberg ,

Thanks. I will try, but I am a bit busy with end of year deadlines, so I don't promise regular updates. But I will try my best.

dvolgyes avatar Dec 01 '22 15:12 dvolgyes

Hi @dvolgyes ,

Have you had some time to try the zsh support?

razrotenberg avatar Feb 12 '23 06:02 razrotenberg

@razrotenberg I am trying but am getting the same error,

I created an env following the quickstart guide,

genv activate --name quick-start

Error

_genv_append_to_env:3: bad substitution

on

zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

However, shifting to bash worked.

Also, while I'm at it - is there no concept of removing/deleting the environments?

genv --help didn't help in this regard, and the documentation also doesn't seem to mention anything around this? Am I missing something?

I have these now and don't know how to get rid of them.

(genv) (base) atom@atom:~$ genv envs
ID      USER            NAME            CREATED              PID(S)
78262   atom(1000)      quick-start     13 minutes ago       78262 78262 78262 78262
113516  atom(1000)      quick-start     1 minute ago         113516

kill <pid> doesn't seem to work.

varungupta31 avatar Sep 14 '24 19:09 varungupta31