1

As far as I know different bash shell processes have different stacks for dirs -v. Is it possible to make different bash shell processes to share the same stack? Thanks.

If it can simplify the problem, I don't very care about the order of the pathnames in the stack.

Tim
  • 101,790
  • In reference to your recent questions on dirs, do you mean: initially at startup, or in a continuously updated way? – Jeff Schaller Jan 12 '18 at 17:37
  • I am fine with either automatically updating periodically, or manually updating by running some command – Tim Jan 12 '18 at 17:38
  • My best idea would be to save $DIRSTACK out to a temp file, and have the other shells read it in. Not sure how to handle coordination of that file, though -- which shell "wins"? – Jeff Schaller Jan 12 '18 at 17:59
  • Do you mean the problem is how to synchronize the multiple writes by different shells into the shared file? – Tim Jan 12 '18 at 18:01
  • Shell 1 does a pushd and writes to the file; if shell 2 doesn’t read the file before doing its own pushd, who wins? – Jeff Schaller Jan 12 '18 at 18:03
  • They can both append their pathnames to the shared file. I am not very picky about broadcasting the change to the file to every shell immediately. Just periodical update by some daemon is good – Tim Jan 12 '18 at 18:05

0 Answers0