

No harm in it apart from people looking weird at you.
A bit more important: wrap your parameter expansions in double quotation marks. E.g. ${probe_output} → "${probe_output}" Otherwise bash will do globbing and splitting on it and you most likely don’t want that. Often times it’s not required, but it’s a good habit to have just in case.
Another one is passing -r to read so that it won’t feast on your backslashes.


Why do you need some terminal remote control for determining the working directory of a terminal exactly? Can’t you just go down the process tree until you find the shell and do
realpath /proc/<pid>/cwdon it? Am I missing something?