Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ######################################################################
- #Copyright (C) 2022 Kris Occhipinti
- #https://filmsbykris.com
- #This program is free software: you can redistribute it and/or modify
- #it under the terms of the GNU General Public License as published by
- #the Free Software Foundation, either version 3 of the License, or
- #(at your option) any later version.
- #This program is distributed in the hope that it will be useful,
- #but WITHOUT ANY WARRANTY; without even the implied warranty of
- #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- #GNU General Public License for more details.
- #You should have received a copy of the GNU General Public License
- #along with this program. If not, see <http://www.gnu.org/licenses/>.
- ######################################################################
- cal > "/tmp/mycal"
- echo "Take out Trash
- Clean Bathroom
- Go for jog
- Pick up supplies" > "/tmp/mytodo.lst"
- paste "/tmp/mycal" "/tmp/mytodo.lst"
Advertisement
Comments
-
- #!/bin/bash
- # Hi, Kris! Thank you for your help. The whole script looks like this.
- set -e
- readonly TODO_DIRECTORY="${TODO_DIRECTORY:-"${HOME}/Documents/todo"}"
- readonly TODO_EDITOR="${EDITOR}"
- readonly TODO_FILE="$(date +%Y-%m-%d).md"
- readonly TODO_PATH="${TODO_DIRECTORY}/${TODO_FILE}"
- if [ ! -d "${TODO_DIRECTORY}" ]; then
- while true; do
- printf "%s does not exist, do you want to create it? (y/n) " "${TODO_DIRECTORY}"
- read -r yn
- case "${yn}" in
- [Yy]* ) mkdir -p "${TODO_DIRECTORY}"; break;;
- [Nn]* ) exit;;
- * ) printf "Please answer y or n\n\n";;
- esac
- done
- fi
- if [ ${#} -eq 0 ]; then
- if [ -p "/dev/stdin" ]; then
- (cat; printf "\n") >> "${TODO_PATH}"
- else
- cal -m > "/tmp/mycal"
- LC_ALL=ru_RU.utf8 date +"ToDo: %d %B, %Y" > "/tmp/mytodo.lst"
- echo "=====================" >> "/tmp/mytodo.lst"
- cat "${TODO_DIRECTORY}/${TODO_FILE}" >> "/tmp/mytodo.lst"
- paste "/tmp/mycal" "/tmp/mytodo.lst"
- # eval "${TODO_EDITOR}" "${TODO_PATH}"
- fi
- else
- printf "%s\n" "${*}" >> "${TODO_PATH}"
- cal -m > "/tmp/mycal"
- LC_ALL=ru_RU.utf8 date +"ToDo: %d %B, %Y" > "/tmp/mytodo.lst"
- echo "=====================" >> "/tmp/mytodo.lst"
- cat "${TODO_DIRECTORY}/${TODO_FILE}" >> "/tmp/mytodo.lst"
- paste "/tmp/mycal" "/tmp/mytodo.lst"
- fi
Add Comment
Please, Sign In to add comment
Advertisement