5
3

More than 5 years have passed since last update.

パスからディレクトリ名/ファイル名を取り出す

Posted at

ディレクトリ名


$ dirname /path/to/hoge
/path/to

ファイル名


$ basename /path/to/hoge
hoge

どういうときに使ってる?

  • 雑にPATHを通したいとき

ex. SwiftコマンドにPATHを通す


$ export PATH=$PATH:`find /Applications/Xcode6-Beta*.app -name swift|grep bin|xargs -I{} dirname {}`


5
3
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
5
3