Score:0

Bash: control a prompt program

cn flag

I've searched all over Google and the StackExchange sites, but all of the answers may work for the programs they used, but not for this (timecalc).

This program is similar of fsck, having a ">>>+" prompt when opened and, apparently, not supporting receiving programmatic usage/commands unless through a Bash trick.

How to send commands to timecalc as if using its prompt but from an external bash script? [OPTIONAL] Bonus: a solution that works also at fsck and most of other prompt/interaction-only programs.

./timecalc sample command to test: 15:00 - 5:00 (should return "10:00" to the bash script)

hr flag
You could consider using [dateutils](http://www.fresse.org/dateutils/) (available from the Ubuntu `universe` repository) instead ex. `dateutils.ddiff -f %0H:%0M 5:00 15:00`
Score:1
ua flag

For example:

$ echo 15:00 - 5:00 | timecalc-linux | head -n1 | sed 's,^>>> ,,'
10:00
cn flag
It works! Many thanks. Would this solution also work for fsck by adapting the ">>" in sed?
Arkadiusz Drabczyk avatar
ua flag
I think it would but you should ask a separate question, maybe you just need `yes`
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.