0

I have this command called reclone, and this is my script:

. load

sudo -v

extract

sudo rm -rf /$organization/$repository

cd /$organization

git clone --depth 1 git@github.com:$organization/$repository

cd /

Basically, I call my other scripts to extract some data related to the PWD and find out the name of the org and repo, delete the repo, and use git clone to clone it again.

It works fine. The problem is that since I call the reclone command in the /some-org/some-repo directory, and inside I remove that directory, the cd / at the end does not work.

This means when the reclone is completed, the user is still at the /some-org/some-repo which has an invalid handle, and all future commands would show errors.

How can I tell the parent shell from within my custom command to change the directory? Is there a way for this at all?

0 Answers0