Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why not make your dreams real then? Here's a barebones zsh function. (Bash fails at export part. If remember right, in past, had wanted to set variables from subshell results and used some eval shenanigans.)

    function my_env() {
        ENVDIR=${ENVDIR:-/var/share/env}
        arg="$1"
        case "$arg" in
            --add)
                echo "$3" >> $ENVDIR/"$2"
                ;;
            *)
                (
                    for f in $ENVDIR/*; do
                        export $(basename $f)="$(< $f | sed -z 's/\n:/:/g')"
                    done
                    [[ -z "$arg" ]] && env || env "$arg"
                )
                ;;
        esac
    }
(Of course, that's a bad approach but your idea is certainly doable in a good way.)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: