Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

軽い仕事のためにディレクトリ移動したくない場合、グループ化を起動させると楽

別の仕事を実行中、割り込み仕事が入るケースありますよね。
しかもディレクトリ移動しないと出来ないようなもの。

いままでは新規タブ開いてやってましたが、
コマンド群を()で括ることでサブプロセスを起動する手があります

$ ( cd /cygdrive/c/Users/SHUZO/Desktop/; #仕事内容; )

てな感じでやれば、とりあえず移動せずともアレコレできます。

man bashでは

Compound Commands
A compound command is one of the following:

(list) list is executed in a subshell environment (see COMMAND EXECU‐
TION ENVIRONMENT below). Variable assignments and builtin com‐
mands that affect the shell's environment do not remain in
effect after the command completes. The return status is the
exit status of list.

と出ています。

参考元