Created
October 4, 2014 12:25
-
-
Save ubnt-intrepid/987dc4749288dde4f727 to your computer and use it in GitHub Desktop.
エクスプローラに登録されたアプリケーションでファイルを開く(MSYS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 絶対パス取得は http://qiita.com/katoy/items/c0d9ff8aff59efa8fcbb#2-4 を参考 | |
# 引数に渡したファイルを登録されたアプリケーションで開く | |
# ※エクスプローラの機能を使用しているためWindows限定 | |
# ※ディレクトリを指定した場合はエクスプローラが起動 | |
function open() | |
{ | |
# MSYSパスからWindowsパスへの変換 | |
# '/c/...' => 'c:/...' | |
# '/' => '\' | |
path=`echo $(realpath $1) | sed -e "s/\\/\([a-z]\)\//\\1:\\//" \\ | |
| sed -e "s/\\\//\\\\\/g"` | |
explorer ${path} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment