From 3ec97fc85c8500d5030cf85d05f059b7e6a62d5d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 23 Mar 2012 18:19:16 +0900 Subject: [PATCH] update o function --- bashrc | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/bashrc b/bashrc index fc72140..a813449 100755 --- a/bashrc +++ b/bashrc @@ -91,8 +91,8 @@ alias psall="ps auxww" alias q=exit alias p="$PAGER" alias c=cat -alias sudo="sudo " # use aliases through sudo alias e3=e3em +alias sudo="sudo " # use aliases through sudo alias halt="sudo halt" alias reboot="sudo reboot" alias rand="echo \$RANDOM" @@ -239,24 +239,33 @@ setclip(){ fi fi } -o(){ - if [ $# -eq 0 ] - then - local f=. +if iswindows; then + alias _open_file='cmd.exe //c start ""' +elif isdarwin; then + alias _open_file=open +elif islinux; then + if null type pcmanfm; then + alias _open_file="LC_MESSAGES= pcmanfm" else - local f="$1" + alias _open_file="LC_MESSAGES= xdg-open" fi - if iswindows - then - cmd.exe //c start "" "$f" - elif isdarwin - then - open "$f" - elif type pcmanfm >/dev/null 2>&1 +else + alias _open_file=cat +fi +o(){ + if test $# -eq 0 then - LC_MESSAGES= pcmanfm "$f" + _open_file . & else - LC_MESSAGES= xdg-open "$f" + for f in "$@" + do + if test -d $f + then + _open_file $f & + else + _open_file $f + fi + done fi } convmv-sjis2utf8-test(){