cleanup WDOTD

This commit is contained in:
Jakobus Schürz 2020-01-22 12:33:14 +01:00
parent c6d3098290
commit d4c7138667

View file

@ -95,15 +95,25 @@ fi
# Create and link Work-Dir of the Day # Create and link Work-Dir of the Day
if [ $(id -u) -ne 0 ]; then if [ $(id -u) -ne 0 ]; then
WDOTD=$(date "+${HOME}/archive/work/%Y/%m/work_%Y%m%d") ARCHIVSUBPATH="archive/work"
ARCHIVPATH="${HOME}/${ARCHIVSUBPATH}"
WDOTD=$(date "+${ARCHIVPATH}/%Y/%m/work_%Y%m%d")
WORKDIR="${HOME}/Work"
[ -e $WDOTD ] || mkdir -pv "${WDOTD}" >>${MYSHELLCONFIG_LOGFILE} [ -e $WDOTD ] || mkdir -pv "${WDOTD}" >>${MYSHELLCONFIG_LOGFILE}
if [[ ( -e "${HOME}/Work" && -h "${HOME}/Work" ) || ! -e "${HOME}/Work" ]] ; then if [[ ( -e "${WORKDIR}" && -h "${WORKDIR}" ) || ! -e "${WORKDIR}" ]] ; then
ln -svnf "${WDOTD}" "${HOME}/Work" >>${MYSHELLCONFIG_LOGFILE} ln -svnf "${WDOTD}" "${WORKDIR}" >>${MYSHELLCONFIG_LOGFILE}
alias gowork='cd "${HOME}/Work"' alias gowork='cd "${WORKDIR}"'
else else
echo "${HOME}/Work exists and is real directory" |tee -a ${MYSHELLCONFIG_LOGFILE} 2>&1 echo "${WORKDIR} exists and is real directory" |tee -a ${MYSHELLCONFIG_LOGFILE} 2>&1
alias gowork='echo "~/Work is not confiugurable, see ${MYSHELLCONFIG_LOGFILE}' alias gowork='echo "${WORKDIR} is not configurable, see ${MYSHELLCONFIG_LOGFILE}'
fi fi
for i in $(find ${ARCHIVPATH} -type d); do
if [ ! "$(ls -A $i)" ]; then
echo "DIR $i is empty -> remove it"
echo rm -rf "$i"
fi
done
fi fi