How to change current work directory using expect script?

前端 未结 2 1560
被撕碎了的回忆
被撕碎了的回忆 2021-01-14 14:36

I want to write an expect script which can do some task and in the end change the directory and give control to the user. I tried using

spawn cd path\\to\\dir

2条回答
  •  青春惊慌失措
    2021-01-14 14:56

    To change the directory in an expect script, you don't need to use the keyword "spawn" it works without it. You may be a little confused, because in the terminal, in which you are executing the script, you will stay in the same directory, but the script changed the directory in which it is doing things.

提交回复
热议问题