Somewhat along the same lines, as I regularly SSH to other hosts with the same network filesystem mounts, 'scd' starts an SSH session on a remote host in the same directory.

  #!/bin/bash
  # SSH to remote system and change into same (current) directory
  DIR=$(pwd)
  ssh -t $1 "cd $DIR; bash -l -i"

i made `rr` (remote run) for a use-case very similar to this.

it expects the remote fs is mounted under .../ssh/HOSTNAME/ and runs any command in that dir on the remote host. if it is not the root which is mounted, looks up mtab for the remote base directory.

https://codeberg.org/hband/hband-tools/src/branch/master/use...