From Bash to Rust
From Bash to Rust I have for about a year had two simple scripts, one that could create bookmarks in my file system, and another that could open a terminal in a bookmarked location selected with dmenu. The management script looked like this:
bfile=$HOME/.config/bookmarks/local-bookmarks.txt afile=$HOME/.config/bookmarks/baliases.sh case $1 in "list") echo "NAME - PATH" ; echo "-----------------------------" ; cat $bfile ; exit 0 ;; "edit") $EDITOR $bfile bmark update_aliases exit 0 ;; "rm") line=$(grep "^$2- " $bfile) || eval 'echo "no bookmark named \"$2\"" ; exit 1' echo "$line" echo $(cat $bfile | sed "/$line/d" ) bmark update_aliases exit 0 ;; "update_aliases") echo "# Autogenerated aliases for bookmarked places" > $afile cat $bfile | awk -F ' - ' '{print "alias _\"" $1 "\"=\"cd " $2"\""}' >> $afile echo "updated bookmark aliases.
2023/04/09 ยท
Projects
/
Bmark