Where is "export var=value" not available?

It is not a bashism but a POSIX compliant syntax. It actually started as a kshism quite a long time ago and was later adopted by almost all Bourne syntax based shells. The only notorious exception is /bin/sh on Solaris 10 and older which sticks to the legacy Bourne shell syntax. Hopefully, Solaris 11 uses a POSIX compliant shell as /bin/sh.

By the way, export was already a builtin command in the legacy Bourne shell so googling for export: command not found was misleading.

Here is the legacy Bourne shell behavior when export is combined with an affectation:

$ export var=22
var=22: is not an identifier

For the nostalgics, the source code of this original Bourne shell is available and can be compiled for most Unix and Linux distributions.


export foo=bar

was not supported by the Bourne shell (an old shell from the 70s from which modern sh implementations like ash/bash/ksh/yash/zsh derive). That was introduced by ksh.

In the Bourne shell, you'd do:

foo=bar export foo

or:

foo=bar; export foo

or with set -k:

export foo foo=bar

Now, the behaviour of:

export foo=bar

varies from shell to shell.

The problem is that assignments and simple command arguments are parsed and interpreted differently.

The foo=bar above is interpreted by some shells as a command argument and by others as an assignment (sometimes).

For instance,

a='b c'
export d=$a

is interpreted as:

'export' 'd=b' 'c'

with some shells (ash, older versions of zsh (in sh emulation), yash) and:

'export' 'd=b c'

in the others (bash, ksh).

While

export \d=$a

or

var=d
export $var=$a

would be interpreted the same in all shells (as 'export' 'd=b' 'c') because that backslash or dollar sign stops those shells that support it to consider those arguments as assignments.

If export itself is quoted or the result of some expansion (even in part), depending on the shell, it would also stop receiving the special treatment.

See "Are quotes needed for local variable assignment?" for more details on that.

The Bourne syntax though:

d=$a; export d

is interpreted the same by all shells without ambiguity (d=$a export d would also work in the Bourne shell and POSIX compliant shells but not in recent versions of zsh unless in sh emulation).

It can get a lot worse than that. See for instance that recent discussion about bash when arrays are involved.

(IMO, it was a mistake to introduce that feature).