You are not logged in.
I'd like following to happen
- i open xfce bash window in linux
- i press F12
- xfce clears command line e.g. <CTRL-C>
- xfce sends command "ssh foo.server.com<enter>"
- xfce sends command "ssh bar.server.com<enter>"
- xfce sends command "sudo su<enter>"
- xfce sends command "ls -lrt /tmp<enter>"
Is it possible to make xfce send those commands to command line like i myself was typing them one after another? Ignoring which server and which user I was and ignoring possible errors?
I might be able to do something like that by changing accels.scm but the correct syntax seems to be hard to find.
Can anyone help?
Last edited by deediidoo431 (2022-11-25 06:31:12)
Offline
before your first step, do you have a Linux text console running? do you want these command line inputs sent to that text console?
your problem appears to be specific to your perspective (like which command line to input to). since i don't understand your perspective, i can't understand your problem or visualize a solution. it appears that you want to accomplish a shell session that logs in to one host as a stepping stone to another then switch to another user then list some files. one issue i see is that step 5 may be written in a misleading way. but step 1 is the most ambiguous due to the lack of perspective.
maybe it is better to just describe the big picture of what you want to accomplish as well as everything you already have and see if we can describe steps that make sense to you.
Offline
before your first step, do you have a Linux text console running? do you want these command line inputs sent to that text console?
your problem appears to be specific to your perspective (like which command line to input to). since i don't understand your perspective, i can't understand your problem or visualize a solution. it appears that you want to accomplish a shell session that logs in to one host as a stepping stone to another then switch to another user then list some files. one issue i see is that step 5 may be written in a misleading way. but step 1 is the most ambiguous due to the lack of perspective.
maybe it is better to just describe the big picture of what you want to accomplish as well as everything you already have and see if we can describe steps that make sense to you.
Yes, imagine situation where in linux i click 'new terminal' and it opens and is active window, then i immediately press F12 and the the terminal would input those commands to the terminal similar to situation where i would write those by hand...
Offline
I'd like following to happen
- i open xfce bash window in linux
- i press F12
- xfce clears command line e.g. <CTRL-C>
- xfce sends command "ssh foo.server.com<enter>"
- xfce sends command "ssh bar.server.com<enter>"
- xfce sends command "sudo su<enter>"
- xfce sends command "ls -lrt /tmp<enter>"Is it possible to make xfce send those commands to command line like i myself was typing them one after another? Ignoring which server and which user I was and ignoring possible errors?
I might be able to do something like that by changing accels.scm but the correct syntax seems to be hard to find.Can anyone help?
Season Greetings to you!
From what you described, it would appear that "xdotool" does what you want to accomplish. Have you looked at it? Worth a try ...
Cheers, m4a
Linux Mint 21.3 -- xfce 4.18 ... Apple iMAC -- Lenovo, Dell, HP Desktops and Laptops -- Family & Community Support
Offline
a keyboard shortcut plus a script plus a small text file might do what you want. it won't be exactly what you expect and it might be too much different from what you really want.
1. create a bash script named "run_my_command.bash". what this script is to do is read the file "my_command.txt" and take the first line of that text and run "bash -c" with all of that text in one argument in the script file.
2. set up a keyboard shortcut for F12 so that runs the command "bash run_my_command.bash".
3. store the command you want to run in "my_command.txt". open a terminal and focus you keyboard on its window (this may be done automatically). press F12. you will see "bash run_my_command.bash" typed in (not the command you saved). then the command you saved in file "my_command.txt" will be run by the script "run_my_command.bash".
this is different than perhaps you wanted because the ultimate appearance is not as if you had typed in that new command. this is because it is too involved to dynamically change a keyboard shortcut (maybe someone knows a better way). or you can just manually change the keyboard shortcut with the new command.
this about the best i can suggest. maybe you can try it and describe your results (any output in code tags) and we can improve it from there.
Offline
that script could be:
if [[ -f my_command.txt ]]; then
mycmd=$(head -n1 my_command.txt)
exec bash -c "$mycmd"
else
echo "'my_command.txt' is missing or is not a regular file" 1>&2
fi
because it gets run directly by the "bash" command in the keyboard shortcut, it does not need "#!/bin/bash" and it does not need to be marked executable (because bash reads it).
Offline
[ Generated in 0.013 seconds, 8 queries executed - Memory usage: 544.63 KiB (Peak: 545.25 KiB) ]