#! /usr/bin/env bashset-eset-o pipefailif["$1"];then# Target file specified on command lineTARGET="$1"else# Interactively choose a group and file nameDIRS="`find unreleased_history/ -mindepth 1 -maxdepth 1 -type d`"echo"Choose a group for new release note:"echo"$DIRS" | grep-nEo'[^/]+$'echo-n"Enter a number: "while[!"$DIRNUM"];do read-r DIRNUM;doneDIR="$(echo"$DIRS" | head-n"$DIRNUM" | tail-1)"echo"Choose a file name for new release note (e.g. improved_whatever.md):"while[!"$FNAME"];do read-re FNAME;done# Replace spaces with underscoresTARGET="$(echo"$DIR/$FNAME" | tr' ''_')"fi# Edit/create the file${EDITOR:-nano}"$TARGET"# Add to version control (easy to forget!)git add "$TARGET"