Last change
on this file since 43257 was 36779, checked in by vboxsync, 14 years ago |
Additions/installer/linux: look for konsole before gnome-terminal, assuming that konsole will not be installed on a pure gnome system
|
-
Property svn:eol-style
set to
LF
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.5 KB
|
Line | |
---|
1 | # $Id: sh-utils.sh 36779 2011-04-20 20:55:49Z vboxsync $
|
---|
2 | # Shell script include file
|
---|
3 | ## @file
|
---|
4 | # Shell script routines which are likely to be useful for different scripts
|
---|
5 | #
|
---|
6 |
|
---|
7 | #
|
---|
8 | # Copyright (C) 2009-2011 Oracle Corporation
|
---|
9 | #
|
---|
10 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | # available from http://www.virtualbox.org. This file is free software;
|
---|
12 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | # General Public License (GPL) as published by the Free Software
|
---|
14 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | #
|
---|
18 |
|
---|
19 | # Deal with differing "which" semantics
|
---|
20 | mywhich() {
|
---|
21 | which "$1" 2>/dev/null | grep -v "no $1"
|
---|
22 | }
|
---|
23 |
|
---|
24 | # Get the name and execute switch for a useful terminal emulator
|
---|
25 | #
|
---|
26 | # Sets $gxtpath to the emulator path or empty
|
---|
27 | # Sets $gxttitle to the "title" switch for that emulator
|
---|
28 | # Sets $gxtexec to the "execute" switch for that emulator
|
---|
29 | # May clobber $gtx*
|
---|
30 | # Calls mywhich
|
---|
31 | getxterm() {
|
---|
32 | # gnome-terminal uses -e differently to other emulators
|
---|
33 | for gxti in "konsole --title -e" "gnome-terminal --title -x" "xterm -T -e"; do
|
---|
34 | set $gxti
|
---|
35 | gxtpath="`mywhich $1`"
|
---|
36 | case "$gxtpath" in ?*)
|
---|
37 | gxttitle=$2
|
---|
38 | gxtexec=$3
|
---|
39 | return
|
---|
40 | ;;
|
---|
41 | esac
|
---|
42 | done
|
---|
43 | }
|
---|
44 |
|
---|
45 | # Quotes its argument by inserting '\' in front of every character save
|
---|
46 | # for 'A-Za-z0-9/'. Prints the result to stdout.
|
---|
47 | quotify() {
|
---|
48 | echo "$1" | sed -e 's/\([^a-zA-Z0-9/]\)/\\\1/g'
|
---|
49 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.