source: trunk/src/elogd.sh @ 70

Last change on this file since 70 was 50, checked in by pinsard, 13 years ago

replace TROPFLUX by PROJECT

  • Property svn:executable set to *
File size: 2.1 KB
RevLine 
[2]1#! /bin/sh
2#+
3#
4# .. program:: elogd.sh
5#
6# .. _elogd.sh:
7#
8# =========================================================================================
[50]9# elogd.sh -- edit the most recent :file:`${PROJECT_LOG}/{action}.log.{YYYYMMDDTHHMMSSZ}`
[2]10# =========================================================================================
11#
12# SYNOPSIS
13# ========
14#
15# ::
16#
17#  $ elogd.sh action
18#
19#
20# DESCRIPTION
21# ===========
22#
[50]23# ``elogd.sh`` launch ${EDITOR} on the most recent release of :file:`${PROJECT_LOG}/{action}.log.{YYYYMMDDTHHMMSSZ}`.
[2]24#
25# .. +todo+ avec sphinx :envvar:`${EDITOR}`
26#
27# .. +todo+ avec sphinx Of course my favourite is :manpage:`vi(1)`.
28#
29# ..
30#   le 1er qui fait une remarque
31#   sur cette ligne a  gagné toute ma considération : il lit les doc !
32#
33# SEE ALSO
34# ========
35#
[50]36# :ref:`project_profile.sh`
[2]37#
38# :ref:`dlogd.sh`
39#
40# :ref:`plogd.sh`
41#
42# :ref:`tlogd.sh`
43#
44# EVOLUTIONS
45# ==========
46#
47# - fplod 20101213T145936Z aedon.locean-ipsl.upmc.fr (Darwin)
48#
49#   * creation
50#
51#-
52#
53set -u
54system=$(uname)
55case "${system}" in
56   AIX|IRIX64)
57      echo " www : no specific posix checking"
58   ;;
59   *)
60      set -o posix
61   ;;
62esac
63unset system
64#
65LANG=POSIX
66#
67command=$(basename ${0})
68#
69if [ ! "${EDITOR}" ]
70then
71   echo " ${command} : eee : EDITOR undefined" >&2
72   exit 1
73fi
74if [ "${1}" = "" ]
75then
76   echo "${command} : eee : 1st parameter missing" >&2
77   exit 1
78fi
79#
[50]80# check for ${PROJECT_LOG} definition
81if [ "${PROJECT_LOG}" = "" ]
[2]82then
[50]83   echo " eee : \${PROJECT_LOG} not defined"
[2]84   exit 1
85fi
86#
[50]87# check for ${PROJECT_LOG} existence
88if [ ! -d ${PROJECT_LOG} ]
[2]89then
[50]90   echo " eee : ${PROJECT_LOG} not found"
[2]91   exit 1
92fi
93#
[50]94# check for permission access on PROJECT_LOG
95if [ ! -x ${PROJECT_LOG} ]
[2]96then
[50]97   echo " eee : ${PROJECT_LOG} not reachable"
[2]98   exit 1
99fi
100#
[50]101log=$(find ${PROJECT_LOG} -name "${1}.log.????????T??????Z" | sort | \
[2]102tail -n 1)
103tmp=${?}
104if [ ${tmp} -eq 0 ]
105then
106   if [ "${log}" = "" ]
107   then
[50]108      echo "${command} : eee : no release of ${PROJECT_LOG}/${1}.log" >&2
[2]109      exit 1
110   else
111      # edit
112      ${EDITOR} ${log}
113      unset log
114      exit 0
115   fi
116else
117   exit 1
118fi
Note: See TracBrowser for help on using the repository browser.