#!/bin/bash #A script that launches documents in their respective viewers #either via dmenu or fzf depending on the context ppid () { ps -p ${1:-$$} -o ppid=; } shell="$(ps aux | grep $( ppid ) | head -n1 | awk '{print $11}' )" document_dirs="$HOME/.config/* $HOME/.local/src/* $HOME/.local/bin/*" #/bin/sh means it's probably from dmenu_run (it's ugly but works) if [ "$shell" = "/bin/sh" ]; then file="$( du -a $document_dirs | awk '{for(i=2; i