Initial answer
The shebang must be the first line to be useful; otherwise, it's just an odd-ball comment.
You should simply run cal
(with its output going to the terminal — standard output) rather than capturing the output of the command in a variable which you then try to execute.
Your script contains the lines:
Date='cal 2000'
echo This is the calendar list for the year 2000
$Date
The last line tries to execute a program 2000
with 462 arguments. To make that work vaguely sanely, you'd need:
Date='cal 2000'
echo "This is the calendar list for the year 2000"
echo "$Date"
The double quotes are crucial to getting a well-formatted output for the value in $date
. See also Capturing multiple line output into a Bash variable.
This should do the job as I understand it:
#!/bin/bash
clear
echo "This is the current year."
Year="$(date '+%Y')"
cal $Year
echo "This is the time:"
date '+%r'
echo "This is the calendar for the year 2000"
cal 2000
From the comments
I don't need the calendar for year 2020. All I need is the four-digit number of 2020 but I still need the calendar for year 2000.
Oh! Well, that requires some trivial changes to the code above:
#!/bin/bash
clear
echo "This is the current year: $(date '+%Y')"
echo "This is the time: $(date '+%r')"
echo "This is the calendar for the year 2000"
cal 2000
Or, if you want the values on a separate line from the descriptions:
#!/bin/bash
clear
echo "This is the current year"
date '+%Y'
echo "This is the time"
date '+%r'
echo "This is the calendar for the year 2000"
cal 2000
There are endless possible variations on this — the choice is yours. Why the year 2000 is so important is mysterious to the outsider, but it is easily managed, as shown.