#!/bin/sh # test_readable.sh - check whether file exists and is readable # usage: test_readable.sh file # Copyright (C) 2013, Wolfgang Scherer, # 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 , # or write to Wolfgang Scherer, # (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)