anki-code / xontrib-sh

Paste and run commands from bash, zsh, fish, tcsh in xonsh shell.
MIT License
54 stars 5 forks source link

Support updating environment variables #7

Open anki-code opened 1 year ago

anki-code commented 1 year ago

The idea:

  1. Get prev_env = $(env) before running the sh-command
  2. Run sh-command. Example ! export QWE=123.
  3. Add saving env at the end of command: ! export QWE=123 ; env > /tmp/post_env.
  4. By comparing prev_env and post_env update the environment in the current session i.e. $QWE='123'

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment