Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Unix/Linux I am struggling to make this code work. It keeps giving errors when trying to run. let current_yr='date +%-Y' let current_mth='date +%-m' let current_day='date

Unix/Linux

I am struggling to make this code work. It keeps giving errors when trying to run.

let current_yr='date +%-Y' let current_mth='date +%-m' let current_day='date +%-d'

echo -e "Do you want to run agecalc (Yes or No): \c" read ans while [$ans = "Yes" ] do echo -e "Enter your name: \c" read name echo -e "Enter your birth year (EX: 1997): \c" read yr_of_birth echo -e "Enter your month of birth(Ex 01-12): \c" read mth_of_birth

if [ $mth_of_birth -le $current_mth ] then let age=$current_yr-$yr_of_birth let age_in_mths=$current_mth-$mth_of_birth else let age=$current_yr-$yr_of_birth-1 let age_in_mths=$current_mth-$mth_of_birth+12 fi

echo $name ", Your age is" $age "years and" $age_in_mths "months."

echo -e "Do you want to run the agecalc again? (Y/N) \c" read ans done

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

T Sql Fundamentals

Authors: Itzik Ben Gan

4th Edition

0138102104, 978-0138102104

More Books

Students also viewed these Databases questions

Question

2. Define identity.

Answered: 1 week ago

Question

1. Identify three communication approaches to identity.

Answered: 1 week ago

Question

4. Describe phases of majority identity development.

Answered: 1 week ago