blob: 9e7b99fea224984de0b872b1b4a5d7038371733b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/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
|