Run command in linux command line

I need to run google chrome on linux with the following command line parameter:

google-chrome --touch-devices=14

      

to correctly identify the touchscreen. Of course, the number of the touch device changes in the new session.

I can find out what number (here 14) I need to enter into the command by running the following:

xinput -list | grep -o "Touchscreen.*id=[0-9]*" | grep -o  [0-9]*

      

Naturally, it would be nice to embed them in one command, but I don't know how to run the command on the command line.

Any help would be greatly appreciated.

+3


source to share


2 answers


google-chrome --touch-devices="$(xinput -list | grep -o "Touchscreen.*id=[0-9]*" | grep -o  [0-9]*)"
google-chrome --touch-devices="`xinput -list | grep -o "Touchscreen.*id=[0-9]*" | grep -o  [0-9]*`"

      

The former is preferred.



ADVICE. Best practice is to run the command xinput

, make sure the output is what you expect, then pipe it togoogle-chrome

+2


source


You can use command replacement :



$ google-chrome --touch-devices="$(xinput -list | grep -o "Touchscreen.*id=[0-9]*" | grep -o  [0-9]*)"

      

+3


source







All Articles