Reputation: 1878
Is it possible in the git custom command to change the console bash directory?
My example code:
#!/bin/bash
# This is a test
cd /c/testfolder
ls
the code is working, but the cd
only works on this block doesn't do any alteration on the bash.
So what I need it is the console /
change to /c/testfolder
Upvotes: 0
Views: 126
Reputation: 719249
It is not possible for a command or shell script to cause the shell / console's current directory to change.
(Unless you are executing the script in the shell itself using source
/ .
. You can't do that with a git
custom command because they are executed by a child process of git
not by the console's shell.)
See Bash script to change parent shell directory for a more detailed explanation of the base problem.
Upvotes: 4