NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#!/bin/bash
function cron(){ #function named as cron
crontab -l > temp #sees temp fiel
echo "$mMinute $mHour $mDate $mnth $daysW (cd /home/nishan/Assignment/arhive/; ./archive.sh)" >> temp #location of files
crontab temp #cronfiile
view_menu
}

function daysW(){ #new function whose name is dayW is created
read -p "Enter the day of week to perform archiving." daysW; #here input should be given by user which include days of week to perform archiving
if [[ $daysW =~ ^[0-6]|[*]$ ]]; ##if condition is ussed tocheck input given by user
then ##continue
view_menu; #show option while performing task
else #if doesnot match then move to nectx step
echo "Please input the day of week>>" ##message which will be displayed on the screen
#daysW;
fi #end of if statements
}

function mnth(){ #function is created whose name is mnth
read -p "Enter the mnth to perform archiving." mnth; #here input should be givwn by user
if [[ $mnth =~ ^[0-12]|[*]$ ]]; #if condition where user can input from 0-12
then #continue
view_menu; #show option or menu
else #otherwise
echo "Please input the month>>" #here input from user
mnth; ##calling function from main function

fi ##end of if statemensts
}

function mDate(){ #function whose name is mDate
read -p "Enter the day of month to perform archiving:" mDate; #user inputvalue over here
if [[ $mDate =~ ^[0-31]|[*]$ ]]; ##if condition is used here
then #continue
view_menu; #menu is shown
else #default or continue progra,m
echo "Please input Date>>" #user should input text here
mDate; #function called from main function
fi #if condition is closed
}

function mHour(){ ##function name is given as mHour
read -p "Enter the Hour to perform archiving:" mHour; #message sis displayed and usser shouldd input text here
if [[ $mHour =~ ^[0-23]|[*]$ ]]; ##if coonditonis used
then #continue
view_menu; #function called grom main function
else #default value from conditoin
echo "Input the value again!>>" ##message which will be displayed n screen
mHour; #function called from main fucntioion
fi #if condition is closed here
}

function mMinute(){ ##funstion name is given as mMinute
read -p "Enter the mMinute to perform archiving:" mMinute; ##minute to perform archiving
if [[ $mMinute =~ ^[0-59]|[*]$ ]]; ##if condition is used here
then ##continue
view_menu; ##menu shown
else #continue
echo "Input the value again!>>" #user input value here when message is displayed

while [[ true ]]; do ##if user input true
view_menu; #start
done
fi
}

view_menu() { #options which is displyed on screen
clear
echo " D I S P L A Y - M E N U" #topic of menu
echo "1. Minute for archiving the data" #options shown on the screen
echo "2. Hour for archiving the data" #options shown on the screen
echo "3. day for archiving the data" #options shown on the screen
echo "4. MONTH for archiving the data" #options shown on the screen
echo "5. days for archiving the data" #options shown on the screen
echo "6. crontab save" #options shown on the screen
echo "7. exit" #options shown on the screen to exit
read -p "Please choose from 1 to 6 " choose;

case $choose in
1) mMinute ;; ##function called from main function
2) mHour ;; #function called from main function
3) mDate ;; #function called from main function
4) mnth ;; #function called from main function
5) daysW ;; #function called from main function
6) cron ;; #to save cron file
7) exit ;; #function called from main function
*) echo -e "${RED}Error...${STD}" && sleep 3 ##sleep for
esac #contiinue

}
view_menu
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.