Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wish it was easier to create "snapshots" of a particular set of environment variables in order to use them later as run environments. I also wish that Unix desktop environments generally made it easier to manage env vars, but that's another complaint. And don't get me started on PAM env vars...



I use Direnv in all of my projects, but it doesn't make it any easier to manage consistent groups of env vars or assign different executables to run in different groups.


Direnv has been mentioned, and it meshes well with functional package managers like Nix and Guix, each of which include the concept of "Profiles". Each profile can access a specific set of programs via it's environment, but PATH is far from the last variable that you can use Direnv or Profiles to control.


Just env vars?

    env > "$(date +s).env-snapshot"
(And use it again slightly more awkwardly as

    <$file | xargs -I@ echo '"@"' | tr '\n' ' ' | xargs -I@ env @ cmd
or something more convenient to `cmd`.)


Should be

  <$file xargs ...


Oops, you've exposed that it started off as a useless cat I knew I'd be chastised for ;)


:)

If it is any consolation, I can't make any sense of this.

  $ <xyz.txt wc -l
         8
  
  $ <xyz.txt | wc -l
         0


> I wish it was easier to create "snapshots" of a particular set of environment variables in order to use them later as run environments.

docker gives you this (but only as part of a whole ecosystem, which for various reasons you might not want to hitch your horse to).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: