Package: ksh
Severity: minor

Hi,

setenv() in the example .kshrc at least in Jessie behaves different than
setenv in tcsh.  Your behaviour with one argument (exporting "$1") makes
more sense than the tcsh's behaviour (exporting and setting "$1" to ""),
but this doesn't seem to be relevant for an undocumented function.  Even
if this would be on purpose, it should not fail if $# is 0.

A verbose ksh93/zsh specific implementation might look similar to this:

    setenv() {
        case $# in
        0) export ;;
        1) export "$1"= ;;
        2) export "$1"="$2" ;;
        esac
    }

A short equivalent one that is set -u safe is:

    setenv() { export ${1+"$1=${2-}"}; }

The possibly shortest one (not set -u safe) is:

    setenv() { export ${1+"$1=$2"}; }

csh's setenv is weird (setenv '$FOO' BAR expands $FOO and uses the
result as variable name) and can only be implemented with eval
- therefore choosing tcsh's setenv instead looks like a good decision.


Carsten


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to