This commit is contained in:
lderidde
2025-02-06 17:58:24 +01:00
parent 68251ee98e
commit 6b0a9cbe2d
2 changed files with 3 additions and 0 deletions

View File

@@ -49,6 +49,8 @@ int builtin_cd(char **arg, t_ast_n *head)
if (ft_strncmp(arg[1], "-", 1) == 0)
{
path = get_var_value("OLDPWD", head->msh->env);
if (path)
ft_printf("%s\n", path);
if (!path)
return (err_msg_cmd("cd", NULL, "OLDPWD not set\n", EXIT_FAILURE));
return (exec_cd(path, head));