Is it possible to run for example history -w for underlying bash shell from ruby script?
Or better is it possible to run builtin command for bash shell knowing only its pid?
The only way I found is to trap signal like trap "history -w" SIGUSR1 and then send signal to process, but I am not sure that it is a good practice and USR1 is not used by bash, also this way I can execute max 2 commands (USR1 and USR2). And I have to define trap before using it.
I am on Mac so there is not SIGRTMIN..SIGRTMAX.
Why I need this:
I created ruby shell script dt which opens new tab next to current with same working dir, then I wrote newTabHere.app that can do same thing but can do this even if tab is busy running something (I call it using Spark). But it will be much better if history will be also same in duplicated tab and for dt I can just use alias dt='history -w; dt', but how can I do this from newTabHere.app?