nixpulvis / oursh

Your comrade through the perilous world of UNIX.
http://nixpulvis.com/oursh/oursh
MIT License
67 stars 6 forks source link

Program Environments / Variables #27

Open nixpulvis opened 6 years ago

nixpulvis commented 6 years ago

POSIX shell scripts like most programs have a notion of bindings with scope. We need to implement the syntax fo assigning (FOO=1) and referencing ($FOO) variables. As part of loading a program it's default environment should be loaded appropriately. The environment variable $ENV denotes the complete working environment for a POSIX program.

Related to #43.

nixpulvis commented 3 years ago

First pass implementation merged in #51.

nixpulvis commented 1 year ago

Key issue we need to fix is related to the scope of variables and their assignment, e.g X=1 echo $X should not print 1 as it does today.

Captured in a few preliminary tests here; https://github.com/nixpulvis/oursh/blob/b064528c596aa80046a407ac77b3e4cab3f6c0b3/tests/posix.rs#L125-L128