Files
@ r44:4c74f9f4c25b
Branch filter:
Location: public/ws-vacation/lib/test_readable.sh - annotation
r44:4c74f9f4c25b
3.4 KiB
text/x-sh
string-match-t, -fsf-compat eliminated
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 r33:49ea552911f9 | #!/bin/sh
# test_readable.sh - check whether file exists and is readable
# usage: test_readable.sh file
# Copyright (C) 2013, Wolfgang Scherer, <Wolfgang.Scherer at gmx.de>
# Sponsored by WIEDENMANN SEILE GMBH, http://www.wiedenmannseile.de
#
# This file is part of Wiedenmann Vacation.
#
: # script help
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>,
# or write to Wolfgang Scherer, <Wolfgang.Scherer at gmx.de>
# (progn (forward-line 1) (snip-insert "gen_hd-configuration" t t "sh") (insert ""))
## (progn (forward-line 1) (snip-insert "sh_b.prog-path" t t "sh") (insert ""))
## (progn (forward-line 1) (snip-insert "sh_b.config.sh" t t "sh") (insert ""))
# --------------------------------------------------
# |||:sec:||| FUNCTIONS
# --------------------------------------------------
usage ()
{
script_help="script-help"
( "${script_help}" ${1+"$@"} "${0}" ) 2>/dev/null \
|| ${SED__PROG-sed} -n '3,/^[^#]/{;/^[^#]/d;p;}' "${0}";
}
## (progn (forward-line 1) (snip-insert "sh_f.hl" t t "sh") (insert ""))
## (progn (forward-line 1) (snip-insert "sh_f.vexec" t t "sh") (insert ""))
## (progn (forward-line 1) (snip-insert "sh_wsrfid.f.config_dump" t t "sh") (insert ""))
## (progn (forward-line 1) (snip-insert "sh.scr.sed" t t "sh") (insert "\n"))
## (progn (forward-line 1) (snip-insert "sh.scr.awk" t t "sh") (insert "\n"))
## (progn (forward-line 1) (snip-insert "sh.scr.perl" t t "sh") (insert "\n"))
## (progn (forward-line 1) (snip-insert "sh.scr.python" t t "sh") (insert "\n"))
# (progn (forward-line 1) (snip-insert "sh_b.opt-loop" t t "sh") (insert "\n"))
test x"${1+set}" = xset && \
case "${1}" in
-\?|-h|--help) usage; exit 0;;
--docu) usage --full; exit 0;;
esac
# --------------------------------------------------
# |||:sec:||| MAIN
# --------------------------------------------------
# |:here:|
## (progn (forward-line 1) (snip-insert-mode "sh.b.wrf.loop" t t) (insert "\n"))
if test -r "${1}"
then
printf "yes\n"
else
printf "no\n"
fi
exit # |||:here:|||
#
# :ide-menu: Emacs IDE Main Menu - Buffer @BUFFER@
# . M-x `eIDE-menu' (eIDE-menu "z")
# :ide: OCCUR-OUTLINE: Sections: `||: sec :||'
# . (x-symbol-tag-occur-outline "sec" '("||:" ":||") '("|:" ":|"))
# :ide: MENU-OUTLINE: Sections `||: sec :||'
# . (x-eIDE-menu-outline "sec" '("||:" ":||") '("|:" ":|"))
# :ide: +-#+
# . Buffer Outline Sections ()
# :ide: SHELL: Run with --docu
# . (progn (save-buffer) (shell-command (concat "sh " (file-name-nondirectory (buffer-file-name)) " --docu")))
# :ide: SHELL: Run with --help
# . (progn (save-buffer) (shell-command (concat "sh " (file-name-nondirectory (buffer-file-name)) " --help")))
# :ide: SHELL: Run w/o args
# . (progn (save-buffer) (shell-command (concat "sh " (file-name-nondirectory (buffer-file-name)) " ")))
#
# Local Variables:
# mode: sh
# comment-start: "#"
# comment-start-skip: "#+"
# comment-column: 0
# End:
# mmm-classes: (here-doc ide-entries)
|