Skip to content

updated 24bit color test#73

Open
TabError wants to merge 1 commit intotermstandard:masterfrom
TabError:master
Open

updated 24bit color test#73
TabError wants to merge 1 commit intotermstandard:masterfrom
TabError:master

Conversation

@TabError
Copy link

Hi,
I just tried the 24-bit-color.sh script and I spotted some bugs. Just fixed them and pushed them in my private dotfiles and figured it would be nice to update the link in this repo too.

btw: i think the other script "img.sh" also doesn't work as shown in this repos README.md because it needs an argument.

@TabError
Copy link
Author

ah, and here the diff of the scripts

image

@kurahaupo
Copy link
Member

kurahaupo commented Jan 13, 2026

That script is so far from "good" practice for shell scripting that I think we should simply remove the link to it.

If you're going to the trouble of replacing #!/bin/bash with #!/usr/bin/env bash, you're clearly aware this is not a POSIX shell script, in which case, why the continued insistence on using $(seq …) ?

Replacing printf with echo is a retrograde step, making it less portable; running the script through ShellCheck would have highlighted this.

@TabError
Copy link
Author

Im really no expert in bash scriptign or POSIX compliance.

I just noticed, that it did not do what it's supposed to do. E.g. the decreasing sequence wasn't rendered at all. (at least on my machine.)

We can change it back to #!/bin/bash. (I thought env bash would be more portable, but as I said i don't have the expertise.)

@TabError
Copy link
Author

So, i updated the script again. I think it's now POSIX compatible ...

https://gitlab.gwdg.de/janphilipp.ressler/dotfiles/-/raw/main/bin/24bit-color-test

@kurahaupo
Copy link
Member

kurahaupo commented Feb 2, 2026

The reason I mention seqis not because it's broken, but because you don't need it.

And I mention "not POSIX" because in Bash you can just write:

for ((index=lower_bound ; index <= upper_bound ; ++index)) do
    do_stuff_with_index "$index"
done

or to count in reverse

for ((index=upper_bound ; index >= lower_bound ; --index)) do
    do_stuff_with_index "$index"
done

These examples assume both upper and lower bounds are inclusive.

@TabError
Copy link
Author

TabError commented Feb 11, 2026

The reason I mention seqis not because it's broken, but because you don't need it.

Ok, but why would i not want to use seq then? It works just fine and i personally like the syntax very much. It is not POSIX conform, but the c style for loop isn't either.

I actually don't get the points you want to make. It is probably because you are much more experience in this whole shell scripting stuff. So please, can you go a little bit more into reasoning of what is the 'actual' problem .... What are the aspects that are relevant?

If, on the other hand, you don't have any intent of updating the current linked script or want to remove it, then do it. I don't mind. I have the script i want in my repo now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants