diff -ur on17/usr/src/cmd/sh/bltin.c bc-on17/usr/src/cmd/sh/bltin.c --- on17/usr/src/cmd/sh/bltin.c Tue Jun 14 02:44:42 2005 +++ bc-on17/usr/src/cmd/sh/bltin.c Sat Jul 9 22:44:00 2005 @@ -314,11 +314,20 @@ { while (*++argv) { - n = lookup(*argv); - if (n->namflg & N_FUNCTN) - error(badexport); - else - attrib(n, N_EXPORT); + register unsigned char *s = mactrim(*argv); + + /* + * Try an export syntax of 'export FOO=1' first. If that + * fails, assume they've already set the variable and + * parse the argument as a variable for possible export. + */ + if (setname(s, N_EXPORT) == FALSE) { + n = lookup(*argv); + if (n->namflg & N_FUNCTN) + error(badexport); + else + attrib(n, N_EXPORT); + } } } else diff -ur on17/usr/src/cmd/sh/name.c bc-on17/usr/src/cmd/sh/name.c --- on17/usr/src/cmd/sh/name.c Tue Jun 14 02:44:42 2005 +++ bc-on17/usr/src/cmd/sh/name.c Sat Jul 9 22:50:28 2005 @@ -165,6 +165,7 @@ } +int setname(argi, xp) /* does parameter assignments */ unsigned char *argi; int xp; @@ -194,9 +195,10 @@ assign(n, argscan); dolocale(n->namid); - return; + return TRUE; } } + return FALSE; } replace(a, v)