Compare commits
2 Commits
88aa4a4168
...
f16fb892cd
Author | SHA1 | Date |
---|---|---|
114465 | f16fb892cd | |
114465 | a4712b8f46 |
|
@ -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
|
||||
|
|
|
@ -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.
|
|
@ -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
|
Loading…
Reference in New Issue