diff --git a/solution/addsuffix b/solution/addsuffix new file mode 100755 index 0000000..a48a335 --- /dev/null +++ b/solution/addsuffix @@ -0,0 +1,5 @@ +#! /bin/bash + +for ((i = 2; i <= $#; i++)); do + mv $"${!i}" $"${!i}$1" +done diff --git a/solution/fizzbuzz.sh b/solution/fizzbuzz.sh new file mode 100755 index 0000000..054522f --- /dev/null +++ b/solution/fizzbuzz.sh @@ -0,0 +1,16 @@ +#! /bin/bash + +for ((i = 1; i <= $1; i++)); do + a=$(($i%3)) + b=$(($i%5)) + c=$(($i%15)) + if [[ c -eq 0 ]]; then + echo Fizz Buzz + elif [[ b -eq 0 ]]; then + echo Buzz + elif [[ a -eq 0 ]]; then + echo Fizz + else + echo $i + fi +done diff --git a/solution/reverse b/solution/reverse new file mode 100755 index 0000000..0b7f582 --- /dev/null +++ b/solution/reverse @@ -0,0 +1,3 @@ +#! /bin/bash + +tac $1 diff --git a/solution/untar b/solution/untar new file mode 100755 index 0000000..bff6656 --- /dev/null +++ b/solution/untar @@ -0,0 +1,7 @@ +#! /bin/bash + +input=$"$1" +directory=$"$input.unpacked" +rm -rf $"$directory" +mkdir $"$directory" +tar -xf $"$input" -C $"$directory"