ShellJS - にほんご。

cd()

更新日: 2018-09-11

cd([dir])

利用可能オプション

無し

指定方法

cd('../');

スクリプトの実行中にディレクトリとdirに変更します。

使用例

ディレクトリを変更し、パスを出力します。

構造
root
|-- data_dir
`-- test.js
JavaScript
var sh = require('shelljs');
sh.cd('./data_dir');
sh.echo(sh.pwd());
sh.echo('----------');
sh.cd('../');
sh.echo(sh.pwd());
結果
$ node sample.js
root/data_dir
----------
root/


© 2012 Artur Adib Released under the BSD License. See LICENSE file for details.

このコンテンツはArtur Adib(arturadib)によるShellJSドキュメントを翻訳/改変したものです。