Trying to paste a typed command to a terminal

I am very new to robotics and ROS and am looking for some help trying to create some keyboard shortcuts that allow me to paste them into a terminal.

Currently i am using the xdotool to do this. I am able to create a new shortcut and have the xdotool print to the terminal if i do something simple like ( ex. 'Hello world' or 'test' ) The text i need to have printed to the terminal has several differant symbols and characters, i dont know if this is why i am having an issue.

The typed text i need to printed is:

rosservice call /xm540arm/torque_enable "{cmd_type: 'group', name: 'arm', enable: false}"

when creating a new shortcut this is what i have put in the command section:

/bin/bash -c "sleep 0.5 && xdotool type 'rosservice call /xm540arm/torque_enable "{cmd_type: 'group', name: 'arm', enable: false}"'

I am not sure if the way i am doing this is correct or not, i am open to any suggestions or other options to accomplish this task.

any help would be greatly appreciated

thanks Mike


Solution 1:

Since you have a double-quoted string, you need to escape any internal double quotes so that they are not read as ending the quoted string:

/bin/bash -c "sleep 0.5 && xdotool type 'rosservice call /xm540arm/torque_enable \"{cmd_type: 'group', name: 'arm', enable: false}\"'"