View previous topic :: View next topic |
Author |
Message |
dasPaul Apprentice
Joined: 14 Feb 2012 Posts: 243 Location: Dresden
|
Posted: Sun Aug 04, 2019 6:56 am Post subject: new xterm window with text not executed |
|
|
Hi
I wonder if it is possible to open a new xterm window with a command written in it but not
executet so that the user just needs to hit enter to execute it...
Is that doable? _________________ -=human without Windows®=-
sorry for my bad english! |
|
Back to top |
|
|
dasPaul Apprentice
Joined: 14 Feb 2012 Posts: 243 Location: Dresden
|
Posted: Sun Aug 04, 2019 7:15 am Post subject: |
|
|
sorry for that dumb question.
Solved by writing a simple bash script:
x.sh
Code: | #!/bin/bash
echo "ls; df; free;"
read
ls
df
free |
Code: | xterm -e "bash x.sh" |
_________________ -=human without Windows®=-
sorry for my bad english! |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21633
|
Posted: Sun Aug 04, 2019 3:58 pm Post subject: |
|
|
If the script is simple enough, you don't even need it to be a separate file: Code: | xterm -e '/bin/bash -c "read;ls;free;read"' | I put an extra read at the end since my normal configuration xterm automatically exits when the contained program exits, so without that second read, the window will disappear before I can read the content. |
|
Back to top |
|
|
dasPaul Apprentice
Joined: 14 Feb 2012 Posts: 243 Location: Dresden
|
Posted: Mon Aug 05, 2019 3:12 pm Post subject: |
|
|
Hu wrote: | If the script is simple enough, you don't even need it to be a separate file: Code: | xterm -e '/bin/bash -c "read;ls;free;read"' | I put an extra read at the end since my normal configuration xterm automatically exits when the contained program exits, so without that second read, the window will disappear before I can read the content. |
Thanks, but this opens just a blank window, I wanted a window with the commands written in it so that the user knows what is executed if he presses enter _________________ -=human without Windows®=-
sorry for my bad english! |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Mon Aug 05, 2019 3:18 pm Post subject: |
|
|
dasPaul wrote: | Hu wrote: | If the script is simple enough, you don't even need it to be a separate file: Code: | xterm -e '/bin/bash -c "read;ls;free;read"' | I put an extra read at the end since my normal configuration xterm automatically exits when the contained program exits, so without that second read, the window will disappear before I can read the content. |
Thanks, but this opens just a blank window, I wanted a window with the commands written in it so that the user knows what is executed if he presses enter |
Then add an echo statement before the 1st read.
Code: | xterm -e '/bin/bash -c "echo \"ls, free\";read;ls;free;read"' |
Although I would consider using either Xdisplay or Xmessage instead of xterm, if you're going to get too complicated. _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
|