A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 one year ago
SSH HELP (BASH): I am trying to write a bash script to determine the gross pay of workers, here is what I have so far what am I missing, I can provide further details if needed. Thanks
if [ hours_worked le 40 ] ; then
(rate*hours_worked)+ bonus_pay
elif [$hours_worked gt 40 ] && [$hours_worked le 54] ; then
((rate*40)+((rate*2)*(hours_worked40)+ bonus_pay)) && (rate*hours_worked)+ bonus_pay
else
((rate*40)+((rate*2)*14)+((rate*3)*(hours_worked54)+ bonus_pay))
fi
anonymous
 one year ago
SSH HELP (BASH): I am trying to write a bash script to determine the gross pay of workers, here is what I have so far what am I missing, I can provide further details if needed. Thanks if [ hours_worked le 40 ] ; then (rate*hours_worked)+ bonus_pay elif [$hours_worked gt 40 ] && [$hours_worked le 54] ; then ((rate*40)+((rate*2)*(hours_worked40)+ bonus_pay)) && (rate*hours_worked)+ bonus_pay else ((rate*40)+((rate*2)*14)+((rate*3)*(hours_worked54)+ bonus_pay)) fi

This Question is Open

rsmith6559
 one year ago
Best ResponseYou've already chosen the best response.0For this type of problem, you may want to consider starting with the largest comparison first and working your way down to the smallest. Your else if code has a "&&" in it. What are you comparing? "&&" is the logical and operator used like: if [[ $THIS && THAT ]] then In BASH, when you want to use the value of a variable, the variable needs to be referred to as $VARIABLE_NAME. You need the '$'. Variables in BASH are held as strings. All math operations require the double parenthesis.

rsmith6559
 one year ago
Best ResponseYou've already chosen the best response.0By the way, what does SSH have to do with this?
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.