Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ディレクトリに入るたびにdされるローカル.bashrcファイルのように。sourceこれを機能させる方法は?
.bashrc
source
エイリアスを使用できます。
$ echo 'echo "execute something for $PWD"' > tests/.cdrc $ _cd() { \cd $1 [ -r .cdrc ] && . .cdrc }
この関数は、最初に引数として指定されたディレクトリに変更し、ファイル.cdrcが読み取り可能かどうかを確認してソースを取得します。
.cdrc
$ alias cd=_cd
それで
$ cd tests execute something for /path/to/tests