aboutsummaryrefslogtreecommitdiff
path: root/.vim/c-support/scripts/wrapper.sh
blob: 55d99611fe4839672ede91203020cd2a181c7443 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
#===============================================================================
#          FILE:  wrapper.sh
#         USAGE:  ./wrapper.sh executable [cmd-line-args] 
#   DESCRIPTION:  Wraps the execution of a programm or script.
#                 Use with xterm: xterm -e wrapper.sh executable cmd-line-args
#                 This script is used by several plugins:
#                  bash-support.vim, c.vim and perl-support.vim
#       OPTIONS:  ---
#  REQUIREMENTS:  which(1) - shows the full path of (shell) commands.
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR:  Dr.-Ing. Fritz Mehner (Mn), mehner@fh-swf.de
#       COMPANY:  Fachhochschule Südwestfalen, Iserlohn
#       CREATED:  23.11.2004 18:04:01 CET
#      REVISION:  $Id: wrapper.sh,v 1.3 2007/10/03 09:06:09 mehner Exp $
#===============================================================================

command=${@}                             # the complete command line
executable=${1}                          # name of the executable; may be quoted

fullname=$(which $executable)
[ $? -eq 0 ] && executable=$fullname

if [ ${#} -ge 1 ] && [ -x "$executable" ]
then
  shift
  "$executable" ${@}
  echo -e "> \"${command}\" returned ${?}"
else
  echo -e "\n  !! file \"${executable}\" does not exist or is not executable !!"
fi
echo -e "  ... press return key ... "
read dummy