2

I am trying to run a simple sh script in git bash with the following commands:

mkdir "last"
cd last

and execute

$sh myscript.sh

I expect that git bash change the directory to last but it is still in the same directory.

I am using windows 7 64bit

1 Answer 1

2
  • You start a new process that changes the directory
  • The calling process ( your shell ) is not influenced by that

You should call the contained statements in your current bash with . myscript.sh to have that process change its directory.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.