devops-exercises

Shell Scripting - Factors

Objectives

Write a script that when given a number, will:

Solution

#!/usr/bin/env bash

(( $1 % 2 )) || res="one factor"
(( $1 % 3 )) || res+="...actually two!"

echo ${res:-$1}