On 2021-06-13 at 09:14, Greg Wooledge wrote: > On Sun, Jun 13, 2021 at 06:10:23PM +0530, Susmita/Rajib wrote: > >> But I need to run the script file with xautolock. > > So, let me see if I understand you. You rambled so much that it's > really not clear what you're asking. But if I'm reading this > sentence right, you have a shell script that requires a terminal to > work, because you prompt the user for input and then read input from > the terminal. > > And now you would like to run this script as a child of xautolock, > which I'm guessing is a pure X11 client program, and does not run > inside a terminal. > > Well, that's just a non-starter. Throw the shell script away, and > write a new program that doesn't require a terminal to do its work. If I'm parsing your rephrasing of the problem statement correctly, couldn't this be addressed by having the script spawn an xterm or similar and run the needed command(s) - perhaps in the form of another script - within that? I have a script which launches an xterm, echos a prompt, and then runs a command which takes input and uses that input to launch another script. It's been working fine for more than a year. In my case the problem could probably be addressed more elegantly by having my script invoke something like gksudo, since the command which takes input in my case is 'su - -c "programname and arguments"', but the design approach seems like it would generalize well to cases which invoke other commands instead. -- The Wanderer The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. -- George Bernard Shaw
Attachment:
signature.asc
Description: OpenPGP digital signature