Monday, January 25, 2010

Command Line Open in UNIX

On OS X I can just "open" any file. On Windows, I can use "start". And on Linux? On modern installations, the "xdg-open" command works just fine. Unfortunately - this is not always the case. And I don't want to remember different commands for different machines. So here is the ultimate open alias setting for bash, for all systems that I use (it can be easily extended for other environments).


 
conditional_alias() {
  UNSET=false
  alias $1 > /dev/null 2>&1 || UNSET=true
  [ x$UNSET = xtrue ] && which $2 > /dev/null 2>&1 && alias $1=$2
}
 
conditional_alias open gvfs-open
conditional_alias open xdg-open
conditional_alias open gnome-open
conditional_alias open exo-open
uname | grep MINGW > /dev/null 2>&1 && alias open=start

3 comments:

  1. Learn to play on line casino games by clicking on the links below. Each link tells 점보카지노 you somewhat in regards to the sport, the principles and provides you an internet video on the game in action. Video Poker gives you the power to compute the probability of acquiring the winning arms as proven on the paytable. Video Poker presents presents variety of the} highest odds of any sport if played appropriately, properly as|in addition to} a low home edge. Every video poker sport is different, but each may have a minimal hand you need to|you should|you have to} make so as to to} win.

    ReplyDelete
  2. What makes SugarHouse standout is that their deposit bonus comes with only a 1x play-through, that means you only need to wager the 1xbet bonus cash once as} earlier than it's eligible for withdrawing. In addition to their free play bonus, Unibet presents a weekly on line casino reload of 25% a lot as} $50 with a 10x play-through requirement. Offering information users a$1,000 deposit match + $25 free on the house, MGM has some of the the} finest value out of the gate, backed by the leading on line casino brand, MGM. To get began, fiat bettors must deposit a minimum of|no much less than} $25 by way of credit card, $100 via P2P switch, $300 by way of cash order, or $1,000 via bank wire.

    ReplyDelete