diff --git a/srcs/builtins/export.c b/srcs/builtins/export.c index 2d4e285..0709ae6 100644 --- a/srcs/builtins/export.c +++ b/srcs/builtins/export.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/12/03 13:36:54 by lperrey #+# #+# */ -/* Updated: 2021/12/06 03:19:30 by lperrey ### ########.fr */ +/* Updated: 2021/12/21 22:41:14 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -50,7 +50,8 @@ int export_var(char *arg) char **var_split; int ret; - ret = 0; + if (arg[0] != '_' && !ft_isalpha(arg[0])) + return (shell_error("export: ", arg, ERR_ID_STR, ERR_ID)); var_split = ft_split(arg, '='); if (!var_split) return (-1); @@ -60,6 +61,7 @@ int export_var(char *arg) ft_free_2d_arr(var_split); return (ERR_ID); } + ret = 0; if (ft_strchr(arg, '=')) ret = change_var_value(arg, var_split[0]); ft_free_2d_arr(var_split);