Advertisement
metalx1000

BASH Dialog Shift Log example #1

Oct 7th, 2023
1,474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.40 KB | None | 0 0
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2023  Kris Occhipinti
  4. #https://filmsbykris.com
  5.  
  6. #This program is free software: you can redistribute it and/or modify
  7. #it under the terms of the GNU General Public License as published by
  8. #the Free Software Foundation version 3 of the License.
  9.  
  10. #This program is distributed in the hope that it will be useful,
  11. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. #GNU General Public License for more details.
  14.  
  15. #You should have received a copy of the GNU General Public License
  16. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17. ######################################################################
  18.  
  19. tmpfile="/tmp/shiftlog.tmp"
  20. logfile="/tmp/shiftlog"
  21. backtitle="Cool Fire Department"
  22.  
  23. exec 3>&1;
  24. user="$(dialog --backtitle "$backtitle" --inputbox "Enter the name" 15 30 2>&1 1>&3)"
  25. [[ "$user" ]] || exit
  26.  
  27. date="$(dialog --backtitle "$backtitle" --calendar 'calendar'  5 50 2>&1 1>&3)"
  28. echo $date
  29. [[ "$date" ]] || exit
  30.  
  31.  
  32. #dialog --title "Shift Log" --backtitle "$backtitle" --editbox "$logfile" 16 50 2> "$tmpfile"; cp "$tmpfile" "$logfile"
  33. dialog --title "Shift Log" --backtitle "$backtitle" --editbox "$logfile" 16 50 2> "$tmpfile"; cp "$tmpfile" "$logfile"
  34.  
  35. clear
  36. echo "$user -- $date"
  37. cat $logfile
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement