[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: POSIX replacement for bash's “export -n” ?



Le Mon, Jul 12, 2010 at 08:56:25AM +0100, Chris Jackson a écrit :
>>
>> I would like to send a patch Upstream, but have not found a drop-in replacement
>> for this command, apart from someghing ugly like:
>>
>> BAR=$FOO ; unset FOO ; FOO=$BAR ; unset BAR
>>
>> to replace ‘export -n FOO’.

> * perhaps you can run the commands needing the exported variable
>   in a subshell? (see under "Grouping Commands Together" in the
>   man page). If you export anything in a subshell, it won't be
>   reflected in the "main" shell, but beware, nor will any other
>   shell builtin take effect. (Potentially also not pretty, and/or
>   a lot of work rewriting)

Thanks a lot for the suggestion! In my particular case, I think that it does
what is intended. I will replace the following line of the Perl script that
causes problem with dash:

  open (WOSSNAME, "export -n EMBOSS_ACDCOMMANDLINE;wossname -alpha -auto|") || die "Cannot run wossname";

by the following line:

  open (WOSSNAME, "(unset EMBOSS_ACDCOMMANDLINE; wossname -alpha -auto)|") || die "Cannot run wossname";

This wossname command just prints to stdout a list of available commands from
the EMBOSS software suite

Have a nice day,

-- 
Charles Plessy
Tsurumi, Kanagawa, Japan


Reply to: