Hacker News new | ask | show | jobs
by ndegruchy 602 days ago
I have a couple of favorites (bash):

  # Only provide CDPATH when interactive...
  if [[ $- = *i* ]];
  then
      export CDPATH=:"$HOME"/Projects/
  fi
`CDPATH` is great. It's like having z, j or zoxide installed for configurable paths. While it doesn't fully replace the former, it provides a lot of the useful functionality for me.

  _cleanup_files() {    
      # Cleanup files
      local OFFENDERS=(
   "$HOME"/.java
   "$HOME"/.oracle_jre_usage
   "$HOME"/.pki
   "$HOME"/.wget-hsts
   "$HOME"/.xsession-errors
          ...
      )

      for FILE in "${OFFENDERS[@]}";
      do
   if [[ -e "$FILE" ]];
   then
       trash-put "$FILE"
   fi
      done
  }

  # Prompt
  export PROMPT_COMMAND=_cleanup_files

There are certain files that get created from various apps that I run that aren't really useful (font caches, etc). Try as I might, I can't get them into appropriate XDG-style locations. I could wrap them in boxxy, but this seems simpler. I put them in the trash in case something blew up and I need to recover it.