LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-08-2019, 04:37 PM   #1
T3Q1la
LQ Newbie
 
Registered: Nov 2019
Posts: 1

Rep: Reputation: Disabled
Smile creating continuous calendar with bash


Hello guys,

I started using Ubuntu recently and i wanned to write a little script, but i am not sure how to convert it into bash script.

I would like to display a monthly calendar using cal command. This should repeate as often as desired for different years and month till the user likes to exit the process. As soon as that happens the user has to be given an echo how to stop the prozess.

Do you have any idea how to write it as script? Please let me know, many thanks in advance!
 
Old 11-08-2019, 06:28 PM   #2
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 4,119

Rep: Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152
Can you clarify the input and the output of your desired program? I.e. how does the user tell the program what they want.

A possible solution without writing a program: To output a certain month and year, for example December 2019, the user can just type cal 12 2019. When they want another month, they type cal anothermonth anotheryear. When they want to exit the process, they stop typing.
 
1 members found this post helpful.
Old 11-08-2019, 11:30 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware FreeBSD Win10 MX
Posts: 9,593

Rep: Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069
sounds like a learning curve. start with simple loops, and build up into how to break out of them, stop them from running, echo and read -p "text" var


Here's a freebe
Code:
#!/usr/bin/env bash
var=y
while [[ ${var^^} != 'N' ]] 
do
    read -p "enter month and year, mm/yyyy " date
    cal $date
    read -p "do you want to continue? Y/n " var
done

Last edited by BW-userx; 11-08-2019 at 11:38 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Continuous Integration/Continuous Development with FOSS Tools LXer Syndicated Linux News 0 08-01-2019 06:41 AM
LXer: Continuous Delivery and Continuous Deployment: Keys to the DevOps Revolution LXer Syndicated Linux News 0 04-17-2019 07:21 PM
LXer: Zuul: Proven open-source continuous integration/continuous delivery LXer Syndicated Linux News 0 05-23-2018 09:31 PM
LXer: Perfecting DevOps Continuous Integration and Continuous Delivery with Kayenta LXer Syndicated Linux News 0 04-11-2018 01:42 AM
prompt based calendar program? Calendar? thebeaglebeagle Linux - Software 0 09-15-2003 02:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration