Skip to content

Instantly share code, notes, and snippets.

@ubnt-intrepid
Created October 4, 2014 12:25
Show Gist options
  • Save ubnt-intrepid/987dc4749288dde4f727 to your computer and use it in GitHub Desktop.
Save ubnt-intrepid/987dc4749288dde4f727 to your computer and use it in GitHub Desktop.
エクスプローラに登録されたアプリケーションでファイルを開く(MSYS)
#!/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