notes/scripts/sdir
2022-12-19 01:11:34 -08:00

26 lines
514 B
Bash
Executable file

#!/bin/bash
# used with espanso :rr and :rd 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"