forgive me, the title was hard to come up with as i'm not even sure how to ask this any other way. i have a script that moves it's contents and then nukes the remains. here's the script (works just fine, BTW):
#!/bin/bash
cd ~/test
sudo rsync -av --remove-source-files ~/newbox/ ~/test/
sudo rm -rfv ~/newbox
echo "done --> relocated files and cleaned up."
sudo rm -rf ~/fixScript.sh
newbox
is the containing folder of the script. so as mentioned, this works fine, but when the script exits, the prompt (pwd
) is still inside the directory newbox
which actually no longer exists. what i'm wondering is how to change the prompt at exit to reflect it's new path, one directory up because the fixScript.sh
is executed from within ~/newbox
, but once it's deleted, i'd like the prompt, on exit, to reflect where the script left off: eg. ~/test
.
i hope i'm making myself clear. :P and if there's a clearer title, i'd be happy to repost this under a better title so it can be more easily searched for.
source
or.
is what i was looking for. still makes it a bit clunky in execution, but it's either be klunky or confuse user... users are already confused enough. :D thank you. – WhiteRau Dec 07 '21 at 22:36