diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-24 16:17:37 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-24 16:17:37 +0200 |
commit | 031a267cad2f69a83263587b79c23e9312c451e4 (patch) | |
tree | 879e060df3e0fbe91fc3487ed0d706c9f8d57b71 /bin/common/hextorgb | |
parent | c6ac8de4715bd4d005bbcc190784e1b4133db47b (diff) |
added checks to hexrgb
Diffstat (limited to 'bin/common/hextorgb')
-rwxr-xr-x | bin/common/hextorgb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/common/hextorgb b/bin/common/hextorgb index 63fcbbc..a50dfd9 100755 --- a/bin/common/hextorgb +++ b/bin/common/hextorgb @@ -1,6 +1,14 @@ #!/usr/bin/env sh -tr -d '#' | - tr '[:lower:]' '[:upper:]' | +test which > /dev/null || + exit 1 +if test -t 0 +then + echo "$1" +else + cat /dev/stdin +fi | + tr -d '#' | # remove '#' + tr '[:lower:]' '[:upper:]' | # uppercase is needed for bc sed 's/\([0-9A-F]\{2\}\)/\1\n/g;iibase=16' | bc | tr '\n' ',' | |