vendredi 27 novembre 2020

Should I be using a case statement or an if/else

I am making a script in unix that will read a text file and each record has six fields separated by a pipe. I don't know if I should use a case statement or an if/else statement.

  • If the $JOB has a value of P then NEW_NICE should be set to 3.
  • If the $JOB has a value of S then NEW_NICE should be set to 6.
  • All other values of $JOB should set NEW_NICE to 7.

I kinda wanna use a case statement because it would be simpler, but I also am not sure on how that would look.

Aucun commentaire:

Enregistrer un commentaire