commit 31c65fd0923027f4b2b7b9b9793360a81ed27478 parent 464fbbb5bd617119869afaf5756bf45c359c47f3 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Sun, 19 Jan 2020 19:27:07 +0100 Convert color script to POSIX sh Diffstat:
M | .local/bin/colors-256.sh | | | 9 | ++++++--- |
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/.local/bin/colors-256.sh b/.local/bin/colors-256.sh @@ -1,9 +1,12 @@ -#!/bin/bash +#!/bin/sh +j=0 for i in $(seq 0 255); do printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" - if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then - printf "\n"; + j=$(($j+1)) + if [ $j -eq 16 ]; then + j=0 + printf '\n' fi done