Naji-k / minishell

1 stars 0 forks source link

Looking to expand: $var=naji $var=naji not in env, deleting node #31

Closed Naji-k closed 1 year ago

Naji-k commented 1 year ago

test case: try export var=hey echo $var => hey "CORRECT" but export $var=naji => Looking to expand: $var=naji $var=naji not in env, deleting node

Naji-k commented 1 year ago

it should looking for $var and create new variable called hey=naji, so the export would be like this

var=hey
hey=naji
Naji-k commented 1 year ago

There is a function that maybe could help you called t_env *find_env_by_key(t_env **env_list, char *key); it will return a node with a key=value from env_list

Naji-k commented 1 year ago

export $USER works and adds a new key to the env (key=nakanoun, value=null) BUT export $USER=NAAJ doesn't work


Lexer: {export} | Type: {1} | Index: {0}
Lexer: {$USER=NAAJ} | Type: {1} | Index: {1}
Looking to expand: $USER=NAAJ
$USER=NAAJ not in env, deleting node

it should expand the value of $USER, to add new node to env as (key=expanded$USER, value=NAAJ)