Compare commits

...

2 Commits

Author SHA1 Message Date
114465 f16fb892cd Updated README 2024-02-02 20:38:08 -05:00
114465 a4712b8f46 Added notes-v2 2024-02-02 20:36:52 -05:00
3 changed files with 41 additions and 0 deletions

View File

@ -1,3 +1,4 @@
## Samples of work
* notes.sh - a basic bash script
* notes.sh (v2) - another basic bash script that is much more to my liking

2
notes-v2/README.md Normal file
View File

@ -0,0 +1,2 @@
## A basic bash script to organize lists v2
This script allow you to choose from four options to modify text files stored in ~/.notes_data. You can edit them with vim, make new ones, list existing ones, or delete existing ones. The editor var in the script can be changed to the editor of your choice.

38
notes-v2/notes.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
#Improved version of my other notes.sh script
editor=vim
mkdir ${HOME}/.notes_data/
while true; do
clear
echo -e "What would you like to do? \n1: list notepads \n2: make notepad \n3: edit notepad \n4: remove notepad"
read -p "ctrl + c to exit: " ans
clear
case ${ans} in
1)
ls ${HOME}/.notes_data/
read -p "Press enter to continue: "
;;
2)
read -p "Notepad name: " name
touch ${HOME}/.notes_data/${name}
;;
3)
read -p "Notepad name: " name
$editor ${HOME}/.notes_data/${name}
;;
4)
read -p "Notepad name: " name
clear
read -p "Are you sure you want to remove ${name}? [y/N]: " ans
case ${ans} in
y|Y)
rm ${HOME}/.notes_data/${name}
esac
;;
*)
echo "Error, invalid option"
sleep 3
;;
esac
clear
done