NataliaMedeiros / minishell

0 stars 0 forks source link

Builtin command unset #13

Closed edooarda closed 2 days ago

edooarda commented 1 month ago

Remove the variable from the env and the value of the variable

Ex: re@f1r6s9:~$ env | grep "PWD" PWD=/home/re OLDPWD=/home/re re@f1r6s9:~$ pwd /home/re re@f1r6s9:~$ unset PWD re@f1r6s9:~$ env | grep "PWD" OLDPWD=/home/re re@f1r6s9:~$ cd Documents/ re@f1r6s9:~/Documents$ pwd /home/re/Documents re@f1r6s9:~/Documents$ env | grep "PWD" re@f1r6s9:~/Documents$ echo $PWD /home/re/Documents re@f1r6s9:~/Documents$ unset PWD re@f1r6s9:~/Documents$ echo $PWD

re@f1r6s9:~/Documents$

edooarda commented 1 month ago

The old PWD from the env list will receive no value when the PWD was unset and changed the folder

If it is export again, it gets automatic the value of the cwd.