#!/bin/bash # A script to start editing files # Dependencies: bash, basename, date # By David Penkowoj, 2022-02-18 # implement: fzf -f QUERY DATE="$(date +'%Y-%m-%d')" FILE="$(basename $1)" DIR="$(dirname $1)" if [[ "$DIR" = "." ]]; then if [[ -f "$DATE-A-$FILE" ]]; then "$EDITOR" "$DATE-A-$FILE" else "$EDITOR" "$DATE-B-$FILE" fi else cd "$DIR" if [[ -f "$DATE-A-$FILE" ]]; then "$EDITOR" "$DATE-A-$FILE" else "$EDITOR" "$DATE-B-$FILE" fi fi