Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
new xterm window with text not executed
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
dasPaul
Apprentice
Apprentice


Joined: 14 Feb 2012
Posts: 215
Location: Dresden

PostPosted: Sun Aug 04, 2019 6:56 am    Post subject: new xterm window with text not executed Reply with quote

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
View user's profile Send private message
dasPaul
Apprentice
Apprentice


Joined: 14 Feb 2012
Posts: 215
Location: Dresden

PostPosted: Sun Aug 04, 2019 7:15 am    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14163

PostPosted: Sun Aug 04, 2019 3:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
dasPaul
Apprentice
Apprentice


Joined: 14 Feb 2012
Posts: 215
Location: Dresden

PostPosted: Mon Aug 05, 2019 3:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 4258
Location: Dallas area

PostPosted: Mon Aug 05, 2019 3:18 pm    Post subject: Reply with quote

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.
_________________
Asus m5a99fx, FX 8320 - nouveau, oss4, rx550 for qemu passthrough
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
5.0.13 zen kernel, profile 17.1 (no-pie & modified) amd64-no-multilib
gcc 8.2.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum