notes/scripts/sdir
2022-12-18 19:59:00 -08:00

26 lines
520 B
Bash
Executable file

#!/bin/bash
# used with espanso :rdr and :rdd command
# A simple bookmarking script used in conjunction with rdir
# to save a directory for easy navigation later
# save our current working directory
sdir=$(pwd)
sdoc="${1:-''}"
# allow overwriting of sdrc
set +o noclobber
# define and create .sdrc file
sdrc="$HOME/".sdrc
if [[ ! -f "$sdrc" ]] ; then
/usr/bin/touch "$sdrc"
fi
if [[ $# -gt 0 ]] ; then
sdoc="$1"
else
sdoc=""
fi
echo 'export sdir='"$sdir" > "$sdrc"
echo 'export sdoc='"$sdoc" >> "$sdrc"