sourced in sh, bash
is_nachfeld, is_np, is_vorfeld in alpinodsDit werkt alleen voor gebruikers van bash, dash (sh?) of zsh.
Dit werkt niet met csh of fish.
Instructie voor gebruiker:
Bijvoorbeeld:
ALPINO_HOME=/opt/Alpino . $ALPINO_HOME/env.sh
Het script env.sh:
# tested with: # bash # dash # zsh if [ "`basename -- $0`" = "env.sh" ] then echo echo This script should be sourced, like this: echo echo . $0 echo exit fi if [ "$ALPINO_HOME" = "" ] then if [ "$BASH_VERSION" != "" ] then ALPINO_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" fi fi a=$ALPINO_HOME if [ "$a" = "" ] then echo echo Please set the environment variable ALPINO_HOME echo elif [ ! -x "$a/bin/Alpino" ] then echo echo '$ALPINO_HOME/bin/Alpino is not executable' echo 'Did you set ALPINO_HOME correctly?' echo elif [ "$ALPINO_SET" = "" ] then ALPINO_SET=1 PATH="$a/bin:$a/Tokenization:$a/TreebankTools/bin:$PATH" LD_LIBRARY_PATH="$a/fadd:$a/unix:$a/create_bin/extralibs:$a/TreebankTools/IndexedCorpus${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" if [ "$ZSH_VERSION" != "" ] then p="$PROMPT" prompt off PROMPT="[Alpino] $p" unset p else PS1="[Alpino] $PS1" fi SP_CSETLEN=212 SP_CTYPE=utf8 export ALPINO_HOME export ALPINO_SET export LD_LIBRARY_PATH export SP_CSETLEN export SP_CTYPE fi unset a
Gebruik een wrapper voor elk programma dat afhankelijk is van environment-variabelen.
Je hoeft niet voor elk programma een apart script te maken. Genoeg is één script per directory, met een stel symlinks ernaartoe. Voorbeeld van zo’n script:
#!/bin/bash # afhankelijk van hoe diep dit script staat: export ALPINO_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" a=$ALPINO_HOME export LD_LIBRARY_PATH="$a/fadd:$a/unix:$a/create_bin/extralibs:$a/TreebankTools/IndexedCorpus" exec $0.bin "$@"
Variant voor Pythonscripts:
# ... exec python $0.py "$@"