LoginSignup
4
0

More than 1 year has passed since last update.

シェルスクリプト実行中に一時的に別のフォルダに移動し何かをしたい場合はどうするか(サブシェル SubShellを使う)

Posted at

かっこ() でサブシェルを実行できます。この中で、一時的に別のフォルダに移動し、何かコマンドを実行させ、終わったら元のフォルダに戻ってくることができます。

$ pwd
/hoge
$ (cd /fuga && pwd)
/fuga
$ pwd
/hoge

参考

Temporarily change current working directory in bash to run a command [duplicate]

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0