scapiskipi
scapiskipi

Reputation: 63

Run command in command line option linux

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

google-chrome --touch-devices=14

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

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

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

Naturally, it would be nice to be able to embed these into one command, but I have no clue how to run the command inside the command line option.

Any help will be greatly appreciated.

Upvotes: 3

Views: 125

Answers (2)

Arkadiusz Drabczyk
Arkadiusz Drabczyk

Reputation: 12393

You can use command substitution:

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

Upvotes: 3

Eugeniu Rosca
Eugeniu Rosca

Reputation: 5305

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 first is prefered.

TIP: The best practice is to run the xinput command first, make sure the output is the expected one and then pass it to google-chrome

Upvotes: 2

Related Questions