I have a Makefile with a sshfs command followed with a cd command:
mr: # mount-remote
sshfs -p 5022 -o nonempty myname@myssh.serveur.fr:mnt /home/julien/myworking_path
cd ./working_directory_mwe1/wk_subd_mwe2/
The first command, sshfs works like a charm and correctly mounts both endpoint. However, the cd command does not change directory. I then have to re-type it manually. It then works if I type in manually, but I want it to be done when typing the mr command.
I tried the following instead having in mind that it may be because I have my terminal connecting for 2 seconds while executing the sshfs but that did not work either. I tried to re-run cd every second until it works.
mr: # mount-remote
sshfs -p 5022 -o nonempty myname@myssh.serveur.fr:mnt /home/julien/myworking_path
until cd ./working_directory_mwe1/wk_subd_mwe2/ ; do sleep 1 ; done
Thank you for your kind help :)
EDIT: I forgot to specify that the minimal working directories I tried to cd is exactly the one at the endpoint, actually, I realized my aim is rather:
mr: # mount-remote
sshfs -p 5022 -o nonempty myname@myssh.serveur.fr:mnt /home/julien/myworking_path
cd /home/julien/myworking_path/some_sub_dir1/som_sub_dir2