#!/bin/sh # Resolve an environment path if not present. Pass the name of the path here # and it will output the path. # For instance: orgdresolv ORGD_ROOT will output "$HOME/docs/wr/orgd/" # TODO: add all envvars. # Also, probably best to recursively resolve. So if $ORGD_BIBCSV_PATH not # found, try $ORGD_KT_PATH/biblio.csv, if that envvar not found try # $ORGD_ROOT/kt/biblio.csv, etc etc case $1 in ORGD_ROOT) [ -z "$ORGD_ROOT" ] && echo "$HOME/docs/wr/orgd" || echo "$ORGD_ROOT";; ORGD_KT_PATH) [ -z "$ORGD_KT_PATH" ] && echo "$HOME/docs/wr/orgd/kt" || echo "$ORGD_KT_PATH";; ORGD_MED_PATH) [ -z "$ORGD_MED_PATH" ] && echo "$HOME/docs/wr/orgd/med" || echo "$ORGD_MED_PATH";; ORGD_BIBCSV_PATH) [ -z "$ORGD_BIBCSV_PATH" ] && echo "$HOME/docs/wr/orgd/kt/biblio.csv" || echo "$ORGD_BIBCSV_PATH";; ORGD_SD_PATH) [ -z "$ORGD_SD_PATH" ] && echo "$HOME/docs/wr/orgd/sd" || echo "$ORGD_SD_PATH";; ORGD_CDALIAS_PATH) [ -z "$ORGD_CDALIAS_PATH" ] && echo "$HOME/docs/wr/orgd/sd/cd" || echo "$ORGD_CDALIAS_PATH";; ORGD_TD_PATH) [ -z "$ORGD_TD_PATH" ] && echo "$HOME/docs/wr/orgd/td" || echo "$ORGD_TD_PATH";; ORGD_FIN_MONTHS) [ -z "$ORGD_FIN_MONTHS" ] && echo "$HOME/docs/wr/trk/fin/ent" || echo "$ORGD_FIN_MONTHS";; ORGD_TRK_PATH) [ -z "$ORGD_TRK_PATH" ] && echo "$HOME/docs/wr/trk" || echo "$ORGD_TRK_PATH";; *) exit 1 ;; esac exit 0