0

I run a file in CentOS 6.5

"cd /media/Disk_1/2016

./run_1.in"

If I copy them and run in terminal, it runs well.

But I run the file, terminal doesn't go to "2016" direction.

How do I solve it?

1 Answers1

0

As stated in this question it depends on how you execute your script and what your goal is.

An easy way would be to run the script as . run_1.in but it might be more in your interested to pursue one of the other options presented as answers for that question. They also contain quite a bit of information.

The reason you don't change the directory is that the script is executed in its own environment. One is to execute it in your own environment using the above method, another would be to make it a shell function. The latter is also detailed in the answers to the question: Change current directory from a script

Seth
  • 9,393