help-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

interpreting ARGV[]


From: Miriam English
Subject: interpreting ARGV[]
Date: Wed, 30 Oct 2024 07:19:20 +1000

Hi folks,

I'm reading some colors into an awk program on the commandline using
ARGV[]. I also have colors defined by their names in a library file
function that consists of just a long list of color definitions
reformatted from the one at /usr/share/X11/rgb.txt and written like
this:

        red="255 0 0"
        white="255 255 255"
        black="0 0 0"
        ...

I want the user to be able to input number values, like "255 0 0" or
color names like "red". The problem is, when I get the name "red"
through ARGV[] I can't find a way to reinterpret it as the number value.
It seems like there should be an obvious and simple way to do that, but
I can't see it. Can anybody enlighten me?

Cheers,

 - Miriam

-- 
There are two wolves and they're always fighting.
One is darkness and despair. The other is light and hope.
Which wolf wins?
Whichever one you feed.
  -- Casey in Brad Bird's movie "Tomorrowland"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]