save in variable values of grabc

1

How can I save the RGB values of grabc in variables?

grabc -rgb

or this other code:

xwd -root -silent | convert xwd:- -depth 8 -crop "1x1+$X+$Y" txt:- | grep -om1 '#\w\+'
    
asked by Kiyosaki 24.07.2018 в 05:27
source

1 answer

1

To save variables in bash you can put your command between the following quotes ''

For example:

VAR='COMANDO'

So for the second command you're probably looking for something like this:

VAR='xwd -root -silent | convert xwd:- -depth 8 -crop "1x1+$X+$Y" txt:- | grep -om1 '#\w\+''

The first one is a bit different, because by looking at the documentation , it seems that the -rgb parameter makes the utlity write STDERR instead of STDOUT, so you will need to redirect the output to be able to save the content in the variable:

VAR='grabc -rgb 2>&1'
    
answered by 24.07.2018 / 09:12
source