On 8/26/24 09:19, Harkaitz Agirre wrote: >> > This change makes ash read two variables, TIMED_ALERT and >> > TIMED_ALERT_SECS. ... >> I doubt whether this function is valuable enough to be implemented in >> shell. Users could simply use a script to notify themselves when >> running a long script/command.
Such as opening a new terminal, finding your long-runner with ps, and: while true; do sleep 3; [ $(ps 31085 | wc -l) -lt 2 ] && mp3play blah.mp3 && break done Which I first did in... 2001 I think? Never occurred to me to modify my shell to do it. I didn't even bother to make a watchcat.sh because it's basically a one-liner. (Although half the time I could just type mp3play blah.mp3 into the console window and the long-running thing never read input so that would run as the next command...) >> afaik, even bash doesn't have similar functions by default and I don't >> think busybox ash is the correct place to implement rich interactive >> functions. Things should be done in another way here. >> >> Best regards, >> Yao Zi > > Thank you for your suggestions and time, > > I agree with the changes you propose to the code. > > As I explained to Laurent the point here is that the need for > the notification is usually an afterthought, nearly always I > realize the need for the notification after I the command is > already running. Are you going to similarly modify the shell to retroactively add logging of output that's already scrolled by and continues to do so rather than the arduous task of restarting via ctrl-C cursor up 2>&1 | less enter? > I already sent a patch to the Bash developers, I implemented this > for both bash and busybox long time ago. "Job control should have the ability to respond to a pipeline exiting" might be an argument, albeit possibly a weird one to raise after the 50th anniversary of job control's invention. "Here are two magic environment variables to hardwire my use case into the shell", not so much. There might be a way to ctrl-z, background something using the 'wait" builtin, and fg. Or maybe you could ctrl-z and add a trap on SIGCHLD, but I never bothered getting fancy. MOSTLY what I do is add stage notifications to long-running programs, either by writing === THINGY lines into the log I can grep for, or modifying the terminal's title bar with: printf '\033]2;It's the title bar\007'; sleep 2 (The sleep 2 there is because bash will overwrite the title bar each time an interactive prompt comes up, so to interactively see it happen... Don't need that part in a script.) That wait I can ballpark how long I'm likely to wait for something. Rob _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
