@@ -0,0 +1,42 @@
|
||||
§ =============================================================
|
||||
§ User Macros
|
||||
§ =============================================================
|
||||
|
||||
SetMacro( 'AUTHOR', 'Marcin Woźniak' )
|
||||
SetMacro( 'AUTHORREF', '' )
|
||||
SetMacro( 'COMPANY', 'Cognifide Polska' )
|
||||
SetMacro( 'COPYRIGHT', '' )
|
||||
SetMacro( 'EMAIL', 'marcin.wozniak@cognifide.com' )
|
||||
SetMacro( 'LICENSE', '' )
|
||||
SetMacro( 'ORGANIZATION','' )
|
||||
|
||||
SetFormat( 'DATE', '%x' )
|
||||
SetFormat( 'TIME', '%H:%M' )
|
||||
SetFormat( 'YEAR', '%Y' )
|
||||
|
||||
SetStyle( 'default' )
|
||||
|
||||
§ =============================================================
|
||||
§ File Includes and Shortcuts
|
||||
§ =============================================================
|
||||
|
||||
§ :TODO:14.07.13 12:50:WM: files "paramsub.templates" and "io-redirection.templates": maps, shortcuts? sort alphabetically?
|
||||
|
||||
MenuShortcut( 'Comments', 'c' )
|
||||
MenuShortcut( 'Statements', 's' )
|
||||
MenuShortcut( 'Tests', 't' )
|
||||
MenuShortcut( 'ParamSub', 'p' )
|
||||
MenuShortcut( 'PatternMatching', 'p' )
|
||||
MenuShortcut( 'IO-Redir', 'i' )
|
||||
|
||||
IncludeFile( 'comments.templates' )
|
||||
IncludeFile( 'statements.templates' )
|
||||
IncludeFile( 'tests.templates' )
|
||||
IncludeFile( 'paramsub.templates' )
|
||||
IncludeFile( 'specialparams.templates' )
|
||||
IncludeFile( 'environment.templates' )
|
||||
IncludeFile( 'builtins.templates' )
|
||||
IncludeFile( 'set.templates' )
|
||||
IncludeFile( 'shelloptions.templates' )
|
||||
IncludeFile( 'io-redirection.templates' )
|
||||
IncludeFile( 'patternmatching.templates' )
|
@@ -0,0 +1,70 @@
|
||||
§ =============================================================
|
||||
§ Builtins
|
||||
§ =============================================================
|
||||
|
||||
== LIST: builtins == list ==
|
||||
'alias',
|
||||
'bg',
|
||||
'bind',
|
||||
'break',
|
||||
'builtin',
|
||||
'caller',
|
||||
'cd',
|
||||
'command',
|
||||
'compgen',
|
||||
'complete',
|
||||
'continue',
|
||||
'compopt',
|
||||
'declare',
|
||||
'dirs',
|
||||
'disown',
|
||||
'echo',
|
||||
'enable',
|
||||
'eval',
|
||||
'exec',
|
||||
'exit',
|
||||
'export',
|
||||
'false',
|
||||
'fc',
|
||||
'fg',
|
||||
'getopts',
|
||||
'hash',
|
||||
'help',
|
||||
'history',
|
||||
'jobs',
|
||||
'kill',
|
||||
'let',
|
||||
'local',
|
||||
'logout',
|
||||
'mapfile',
|
||||
'popd',
|
||||
'printf',
|
||||
'pushd',
|
||||
'pwd',
|
||||
'read',
|
||||
'readarray',
|
||||
'readonly',
|
||||
'return',
|
||||
'set',
|
||||
'shift',
|
||||
'shopt',
|
||||
'source',
|
||||
'suspend',
|
||||
'test',
|
||||
'times',
|
||||
'trap',
|
||||
'true',
|
||||
'type',
|
||||
'typeset',
|
||||
'ulimit',
|
||||
'umask',
|
||||
'unalias',
|
||||
'unset',
|
||||
'wait',
|
||||
== ENDLIST ==
|
||||
|
||||
== Builtins == expandmenu, insert, map:bbu, sc:b ==
|
||||
|PickList( 'Builtins', 'builtins' )|
|
||||
|PICK|<CURSOR>
|
||||
== ENDTEMPLATE ==
|
||||
|
@@ -0,0 +1,142 @@
|
||||
§ =============================================================
|
||||
§ Comments
|
||||
§ =============================================================
|
||||
|
||||
== Comments.end-of-line comment == nomenu, append ==
|
||||
# <CURSOR>
|
||||
== Comments.frame == map:cfr, sc:r ==
|
||||
#-------------------------------------------------------------------------------
|
||||
# <CURSOR>
|
||||
#-------------------------------------------------------------------------------
|
||||
== Comments.function == map:cfu, sc:f ==
|
||||
#--- FUNCTION ----------------------------------------------------------------
|
||||
# NAME: |?FUNCTION_NAME|
|
||||
# DESCRIPTION: <CURSOR>
|
||||
# PARAMETERS:
|
||||
# RETURNS:
|
||||
#-------------------------------------------------------------------------------
|
||||
== Comments.file header == start, map:ch ==
|
||||
#!/bin/bash -
|
||||
#===============================================================================
|
||||
#
|
||||
# FILE: |FILENAME|
|
||||
#
|
||||
# USAGE: ./|FILENAME|
|
||||
#
|
||||
# DESCRIPTION:
|
||||
#
|
||||
# OPTIONS: ---
|
||||
# REQUIREMENTS: ---
|
||||
# BUGS: ---
|
||||
# NOTES: ---
|
||||
# AUTHOR: |AUTHOR| , |EMAIL|
|
||||
# COMPANY: |COMPANY|
|
||||
# CREATED: |DATE| |TIME|
|
||||
# REVISION: ---
|
||||
#===============================================================================
|
||||
|
||||
set -o nounset # Treat unset variables as an error
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)/"
|
||||
#source $DIR/settings.sh
|
||||
|
||||
#####################
|
||||
# SETTINGS FILE
|
||||
EMAILSERVER=""
|
||||
EMAILFROM=""
|
||||
EMAILADMIN=""
|
||||
ERRORTITLE=Error-$TITLE
|
||||
#
|
||||
#####################
|
||||
|
||||
LOG="$DIR/log"
|
||||
LOG_FILE="$LOG/log-$(date -I).log"
|
||||
|
||||
function timestamp(){
|
||||
echo "[+] "$(date +'%F %T')" [INFO] $@"
|
||||
}
|
||||
|
||||
function err() {
|
||||
echo "[-] "$(date +'%F %T')" [ERROR] $@" >&2
|
||||
}
|
||||
|
||||
function command_start(){
|
||||
timestamp "Command $1 has been started."
|
||||
if ! $1 ; then
|
||||
err "Command $1 went wrong."
|
||||
sendmailerr
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
function removelogs(){
|
||||
find $LOG -mindepth 1 -mtime +365 -delete
|
||||
}
|
||||
|
||||
function sendmailerr (){
|
||||
echo -e "SERVER-IP: :$(ifconfig | awk '/inet /{print $2}' | sed '/127.0.0.1/d'| tr '\n' ' ')\nSCRIPTNAME: $(basename "$0")" | mailx -v -S smtp=$EMAILSERVER -r $EMAILFROM -s "$ERRORTITLE" -a $LOG_FILE $EMAILADMIN
|
||||
}
|
||||
|
||||
function main(){
|
||||
timestamp "Script has been started"
|
||||
timestamp "Everything looks OK ;-)"
|
||||
}
|
||||
|
||||
main >>$LOG_FILE 2>&1
|
||||
|
||||
|
||||
<CURSOR>
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
§ -------------------------------------------------------------
|
||||
|
||||
== Comments.date == insert, map:cd, sc:d ==
|
||||
|DATE|<CURSOR>
|
||||
== Comments.date+time == insert, map:ct, sc:t ==
|
||||
|DATE| |TIME|<CURSOR>
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
§ -------------------------------------------------------------
|
||||
§ Keywords, Special and Macros
|
||||
§ -------------------------------------------------------------
|
||||
|
||||
== LIST: comments_sections == hash ==
|
||||
'GLOBAL DECLARATIONS' : 'GLOBAL DECLARATIONS',
|
||||
'COMMAND LINE PROCESSING' : 'COMMAND LINE PROCESSING',
|
||||
'SANITY CHECKS' : 'SANITY CHECKS',
|
||||
'FUNCTION DEFINITIONS' : 'FUNCTION DEFINITIONS',
|
||||
'TRAPS' : 'TRAPS',
|
||||
'MAIN SCRIPT' : 'MAIN SCRIPT',
|
||||
'STATISTICS AND CLEAN-UP' : 'STATISTICS AND CLEAN-UP',
|
||||
== LIST: comments_keywords == hash ==
|
||||
'bug' : ':BUG:|DATE| |TIME|:|AUTHORREF|: <CURSOR>',
|
||||
'todo' : ':TODO:|DATE| |TIME|:|AUTHORREF|: <CURSOR>',
|
||||
'tricky' : ':TRICKY:|DATE| |TIME|:|AUTHORREF|: <CURSOR>',
|
||||
'warning' : ':WARNING:|DATE| |TIME|:|AUTHORREF|: <CURSOR>',
|
||||
'workaround' : ':WORKAROUND:|DATE| |TIME|:|AUTHORREF|: <CURSOR>',
|
||||
'new keyword' : ':<CURSOR>:|DATE| |TIME|:|AUTHORREF|: {+COMMENT+}',
|
||||
== LIST: comments_macros == hash ==
|
||||
'AUTHOR' : '|AUTHOR|',
|
||||
'AUTHORREF' : '|AUTHORREF|',
|
||||
'COMPANY' : '|COMPANY|',
|
||||
'COPYRIGHT' : '|COPYRIGHT|',
|
||||
'EMAIL' : '|EMAIL|',
|
||||
'ORGANIZATION' : '|ORGANIZATION|',
|
||||
== ENDLIST ==
|
||||
|
||||
§ -------------------------------------------------------------
|
||||
|
||||
== Comments.script sections == expandmenu, map:css, sc:s ==
|
||||
|PickList( 'script sections', 'comments_sections' )|
|
||||
#===============================================================================
|
||||
# |PICK|
|
||||
#===============================================================================
|
||||
== Comments.keyword comments == expandmenu, append, map:ckc, sc:k ==
|
||||
|PickList( 'keyword comment', 'comments_keywords' )|
|
||||
# |PICK|
|
||||
== Comments.macros == expandmenu, insert, map:cma, sc:m ==
|
||||
|PickList( 'macro', 'comments_macros' )|
|
||||
|PICK|
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
== SEP: Comments.sep1 ==
|
@@ -0,0 +1,100 @@
|
||||
§ =============================================================
|
||||
§ Environment
|
||||
§ =============================================================
|
||||
|
||||
== LIST: environment == list ==
|
||||
'BASH',
|
||||
'BASHOPTS',
|
||||
'BASHPID',
|
||||
'BASH_ALIASES',
|
||||
'BASH_ARGC',
|
||||
'BASH_ARGV',
|
||||
'BASH_CMDS',
|
||||
'BASH_COMMAND',
|
||||
'BASH_ENV',
|
||||
'BASH_EXECUTION_STRING',
|
||||
'BASH_LINENO',
|
||||
'BASH_REMATCH',
|
||||
'BASH_SOURCE',
|
||||
'BASH_SUBSHELL',
|
||||
'BASH_VERSINFO',
|
||||
'BASH_VERSION',
|
||||
'BASH_XTRACEFD',
|
||||
'CDPATH',
|
||||
'COLUMNS',
|
||||
'COMPREPLY',
|
||||
'COMP_CWORD',
|
||||
'COMP_KEY',
|
||||
'COMP_LINE',
|
||||
'COMP_POINT',
|
||||
'COMP_TYPE',
|
||||
'COMP_WORDBREAKS',
|
||||
'COMP_WORDS',
|
||||
'DIRSTACK',
|
||||
'EMAC&S',
|
||||
'EUID',
|
||||
'FCEDIT',
|
||||
'FIGNORE',
|
||||
'FUNCNAME',
|
||||
'FUNCNEST',
|
||||
'GLOBIGNORE',
|
||||
'GROUPS',
|
||||
'HISTCMD',
|
||||
'HISTCONTROL',
|
||||
'HISTFILE',
|
||||
'HISTFILESIZE',
|
||||
'HISTIGNORE',
|
||||
'HISTSIZE',
|
||||
'HISTTIMEFORMAT',
|
||||
'HOME',
|
||||
'HOSTFILE',
|
||||
'HOSTNAME',
|
||||
'HOSTTYPE',
|
||||
'IFS',
|
||||
'IGNOREEOF',
|
||||
'INPUTRC',
|
||||
'LANG',
|
||||
'LC_ALL',
|
||||
'LC_COLLATE',
|
||||
'LC_CTYPE',
|
||||
'LC_MESSAGES',
|
||||
'LC_NUMERIC',
|
||||
'LINENO',
|
||||
'LINES',
|
||||
'MACHTYPE',
|
||||
'MAIL',
|
||||
'MAILCHECK',
|
||||
'MAILPATH',
|
||||
'OLDPWD',
|
||||
'OPTARG',
|
||||
'OPTERR',
|
||||
'OPTIND',
|
||||
'OSTYPE',
|
||||
'PATH',
|
||||
'PIPESTATUS',
|
||||
'POSIXLY_CORRECT',
|
||||
'PPID',
|
||||
'PROMPT_COMMAND',
|
||||
'PROMPT_DIRTRIM',
|
||||
'PS1',
|
||||
'PS2',
|
||||
'PS3',
|
||||
'PS4',
|
||||
'PWD',
|
||||
'RANDOM',
|
||||
'REPLY',
|
||||
'SECONDS',
|
||||
'SHELL',
|
||||
'SHELLOPTS',
|
||||
'SHLVL',
|
||||
'TIMEFORMAT',
|
||||
'TMOUT',
|
||||
'TMPDIR',
|
||||
'UID',
|
||||
== ENDLIST ==
|
||||
|
||||
== Environment == expandmenu, insert, map:ben, sc:e ==
|
||||
|PickList( 'Environment', 'environment' )|
|
||||
|PICK|<CURSOR>
|
||||
== ENDTEMPLATE ==
|
||||
|
@@ -0,0 +1,32 @@
|
||||
§ =============================================================
|
||||
§ IO Redirection
|
||||
§ =============================================================
|
||||
|
||||
== LIST: IORedirection == hash ==
|
||||
'append STDOUT and STDERR &>>': ' &>> <CURSOR>',
|
||||
'close input from file descr n n<&-': ' <CURSOR><&- ',
|
||||
'close output from file descr n n>&-': ' <CURSOR>>&- ',
|
||||
'close STDIN <&-': ' <&- <CURSOR>',
|
||||
'close STDOUT >&-': ' >&- <CURSOR>',
|
||||
'direct file descr n to file, append n>>' : ' <CURSOR>>> ',
|
||||
'direct file descr n to file n>' : ' <CURSOR>> ',
|
||||
'direct STDOUT and STDERR to file &>' : ' &> <CURSOR>',
|
||||
'direct STDOUT to file, append >>' : ' >> <CURSOR>',
|
||||
'direct STDOUT to file >' : ' > <CURSOR>',
|
||||
'direct STDOUT to STDERR >&2' : ' >&2<CURSOR>',
|
||||
'duplicate STDIN from file descr n n<&' : ' <<CURSOR>& ',
|
||||
'duplicate STDOUT to file descr n n>&' : ' ><CURSOR>& ',
|
||||
'take file descr n from file n<' : ' <CURSOR>< ',
|
||||
'take STDIN from file <' : ' < <CURSOR>',
|
||||
== ENDLIST ==
|
||||
|
||||
== IO-Redir.redir == expandmenu, insert, sc:r, map:ior ==
|
||||
|PickList( 'IO-Redir', 'IORedirection' )|
|
||||
|PICK|
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
== IO-Redir.here-document == insert, sc:h, map:ioh ==
|
||||
<<-EOF
|
||||
<SPLIT><CURSOR>
|
||||
EOF
|
||||
== ENDTEMPLATE ==
|
@@ -0,0 +1,33 @@
|
||||
§ =============================================================
|
||||
§ Parameter Substitution
|
||||
§ =============================================================
|
||||
|
||||
== LIST: ParameterSubstitution == hash ==
|
||||
'all lower to upper ${ ^^ }' : '${<CURSOR>^^<+pattern+>}',
|
||||
'all upper to lower ${ ,, }' : '${<CURSOR>,,<+pattern+>}',
|
||||
'assign default value ${ := }' : '${<CURSOR>:=<+word+>}',
|
||||
'display error ${ :? }' : '${<CURSOR>:?<+word+>}',
|
||||
'first lower to upper ${ ^ }' : '${<CURSOR>^<+pattern+>}',
|
||||
'first upper to lower ${ , }' : '${<CURSOR>,<+pattern+>}',
|
||||
'indirect parameter expansion ${! }' : '${!<CURSOR>}',
|
||||
'names matching prefix ${! *}' : '${!<CURSOR>*}',
|
||||
'parameter length ${# }' : '${#<CURSOR>}',
|
||||
'pattern substitution all ${ // / }' : '${<CURSOR>//<+pattern+>/<+string+>}',
|
||||
'pattern substitution begin ${ /# / }' : '${<CURSOR>/#<+pattern+>/<+string+>}',
|
||||
'pattern substitution ${ / / }' : '${<CURSOR>/<+pattern+>/<+string+>}',
|
||||
'pattern substitution end ${ /% / }' : '${<CURSOR>/%<+pattern+>/<+string+>}',
|
||||
'remove all matching prefix pattern ${ ## }' : '${<CURSOR>##<+word+>}',
|
||||
'remove all matching suffix pattern ${ %% }' : '${<CURSOR>%%<+word+>}',
|
||||
'remove matching prefix pattern ${ # }' : '${<CURSOR>#<+word+>}',
|
||||
'remove matching suffix pattern ${ % }' : '${<CURSOR>%<+word+>}',
|
||||
'substitution ${ }' : '${<SPLIT><CURSOR>}',
|
||||
'substring expansion ${ : : }' : '${<CURSOR>:<+offset+>:<+length+>}',
|
||||
'use alternate value ${ :+ }' : '${<CURSOR>:+<+word+>}',
|
||||
'use default value ${ :- }' : '${<CURSOR>:-<+word+>}',
|
||||
== ENDLIST ==
|
||||
|
||||
== ParamSub == expandmenu, insert, sc:p, map:bps ==
|
||||
|PickList( 'Parameter Substitution', 'ParameterSubstitution' )|
|
||||
|PICK|
|
||||
== ENDTEMPLATE ==
|
||||
|
@@ -0,0 +1,51 @@
|
||||
§ =============================================================
|
||||
§ RegExp
|
||||
§ =============================================================
|
||||
|
||||
== PatternMatching.zero or one == insert, map:pzo, sc:z ==
|
||||
?(<SPLIT><CURSOR>|)
|
||||
== PatternMatching.zero or more == insert, map:pzm, sc:z ==
|
||||
*(<SPLIT><CURSOR>|)
|
||||
== PatternMatching.one or more == insert, map:pom, sc:o ==
|
||||
+(<SPLIT><CURSOR>|)
|
||||
== PatternMatching.exactly one == insert, map:peo, sc:e ==
|
||||
@(<SPLIT><CURSOR>|)
|
||||
== PatternMatching.anything except == insert, map:pae, sc:a ==
|
||||
!(<SPLIT><CURSOR>|)
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
== SEP: PatternMatching.sep1 ==
|
||||
|
||||
== LIST: POSIX_CharClasses == list ==
|
||||
'alnum',
|
||||
'alpha',
|
||||
'ascii',
|
||||
'blank',
|
||||
'cntrl',
|
||||
'digit',
|
||||
'graph',
|
||||
'lower',
|
||||
'print',
|
||||
'punct',
|
||||
'space',
|
||||
'upper',
|
||||
'word',
|
||||
'xdigit',
|
||||
== ENDLIST ==
|
||||
|
||||
== PatternMatching.POSIX classes == expandmenu, insert, sc:p, map:ppc ==
|
||||
|PickList( 'POSIX char. classes', 'POSIX_CharClasses' )|
|
||||
[:|PICK|:]<CURSOR>
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
== LIST: BashRematch == list ==
|
||||
'${BASH_REMATCH[0]}',
|
||||
'${BASH_REMATCH[1]}',
|
||||
'${BASH_REMATCH[2]}',
|
||||
'${BASH_REMATCH[3]}',
|
||||
== ENDLIST ==
|
||||
|
||||
== PatternMatching.BASH_REMATCH == expandmenu, insert, sc:b, map:pbr ==
|
||||
|PickList( 'BASH_REMATCH', 'BashRematch' )|
|
||||
|PICK|<CURSOR>
|
||||
== ENDTEMPLATE ==
|
@@ -0,0 +1,51 @@
|
||||
§ =============================================================
|
||||
§ RegExp
|
||||
§ =============================================================
|
||||
|
||||
== Regexp.zero or one == insert, map:xzo, sc:z ==
|
||||
?(<SPLIT><CURSOR>|)
|
||||
== Regexp.zero or more == insert, map:xzm, sc:z ==
|
||||
*(<SPLIT><CURSOR>|)
|
||||
== Regexp.one or more == insert, map:xom, sc:o ==
|
||||
+(<SPLIT><CURSOR>|)
|
||||
== Regexp.exactly one == insert, map:xeo, sc:e ==
|
||||
@(<SPLIT><CURSOR>|)
|
||||
== Regexp.anything except == insert, map:xae, sc:a ==
|
||||
!(<SPLIT><CURSOR>|)
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
== SEP: Regexp.sep1 ==
|
||||
|
||||
== LIST: POSIX_CharClasses == list ==
|
||||
'alnum',
|
||||
'alpha',
|
||||
'ascii',
|
||||
'blank',
|
||||
'cntrl',
|
||||
'digit',
|
||||
'graph',
|
||||
'lower',
|
||||
'print',
|
||||
'punct',
|
||||
'space',
|
||||
'upper',
|
||||
'word',
|
||||
'xdigit',
|
||||
== ENDLIST ==
|
||||
|
||||
== Regexp.POSIX classes == expandmenu, insert, sc:p, map:xpc ==
|
||||
|PickList( 'POSIX char. classes', 'POSIX_CharClasses' )|
|
||||
[:|PICK|:]<CURSOR>
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
== LIST: BashRematch == list ==
|
||||
'${BASH_REMATCH[0]}',
|
||||
'${BASH_REMATCH[1]}',
|
||||
'${BASH_REMATCH[2]}',
|
||||
'${BASH_REMATCH[3]}',
|
||||
== ENDLIST ==
|
||||
|
||||
== Regexp.BASH_REMATCH == expandmenu, insert, sc:b, map:xbr ==
|
||||
|PickList( 'BASH_REMATCH', 'BashRematch' )|
|
||||
|PICK|<CURSOR>
|
||||
== ENDTEMPLATE ==
|
@@ -0,0 +1,36 @@
|
||||
§ =============================================================
|
||||
§ Set
|
||||
§ =============================================================
|
||||
|
||||
== LIST: set == list ==
|
||||
'allexport',
|
||||
'braceexpand',
|
||||
'emacs',
|
||||
'errexit',
|
||||
'errtrace',
|
||||
'functrace',
|
||||
'hashall',
|
||||
'histexpand',
|
||||
'history',
|
||||
'ignoreeof',
|
||||
'keyword',
|
||||
'monitor',
|
||||
'noclobber',
|
||||
'noexec',
|
||||
'noglob',
|
||||
'notify',
|
||||
'nounset',
|
||||
'onecmd',
|
||||
'physical',
|
||||
'pipefail',
|
||||
'posix',
|
||||
'privileged',
|
||||
'verbose',
|
||||
'vi',
|
||||
'xtrace',
|
||||
== ENDLIST ==
|
||||
|
||||
== Set == expandmenu, map:bse, sc:s ==
|
||||
|PickList( 'set option', 'set' )|
|
||||
set -o |PICK|<CURSOR>
|
||||
== ENDTEMPLATE ==
|
@@ -0,0 +1,54 @@
|
||||
§ =============================================================
|
||||
§ Shell Options
|
||||
§ =============================================================
|
||||
|
||||
== LIST: shopt == list ==
|
||||
'autocd',
|
||||
'cdable_vars',
|
||||
'cdspell',
|
||||
'checkhash',
|
||||
'checkjobs',
|
||||
'checkwinsize',
|
||||
'cmdhist',
|
||||
'compat31',
|
||||
'compat32',
|
||||
'compat40',
|
||||
'compat41',
|
||||
'dirspell',
|
||||
'direxpand',
|
||||
'dotglob',
|
||||
'execfail',
|
||||
'expand_aliases',
|
||||
'extdebug',
|
||||
'extglob',
|
||||
'extquote',
|
||||
'failglob',
|
||||
'force_fignore',
|
||||
'globstar',
|
||||
'gnu_errfmt',
|
||||
'histappend',
|
||||
'histreedit',
|
||||
'histverify',
|
||||
'hostcomplete',
|
||||
'huponexit',
|
||||
'interactive_comments',
|
||||
'lastpipe',
|
||||
'lithist',
|
||||
'login_shell',
|
||||
'mailwarn',
|
||||
'no_empty_cmd_completion',
|
||||
'nocaseglob',
|
||||
'nocasematch',
|
||||
'nullglob',
|
||||
'progcomp',
|
||||
'promptvars',
|
||||
'restricted_shell',
|
||||
'shift_verbose',
|
||||
'sourcepath',
|
||||
'xpg_echo',
|
||||
== ENDLIST ==
|
||||
|
||||
== Shopts == expandmenu, insert, map:bso, sc:o ==
|
||||
|PickList( 'Shopts', 'shopt' )|
|
||||
shopt -s |PICK|<CURSOR>
|
||||
== ENDTEMPLATE ==
|
@@ -0,0 +1,21 @@
|
||||
§ =============================================================
|
||||
§ Special Parameters
|
||||
§ =============================================================
|
||||
|
||||
== LIST: SpecialParameters == hash ==
|
||||
'number of posit. param., ${#}' : '${#}',
|
||||
'all posit. param. (quoted spaces), ${*}' : '${*}',
|
||||
'all posit. param. (unquoted spaces), ${@}' : '${@}',
|
||||
'number of posit. parameters, ${#@}' : '${#@}',
|
||||
'return code of last command, ${?}' : '${?}',
|
||||
'PID of this shell, ${$}' : '${$}',
|
||||
'flags set, ${-}' : '${-}',
|
||||
'last argument of prev. command, ${_}' : '${_}',
|
||||
'PID of last background command, ${!}' : '${!}',
|
||||
== ENDLIST ==
|
||||
|
||||
== SpecParams == expandmenu, insert, sc:p, map:bsp ==
|
||||
|PickList( 'Special Parameters', 'SpecialParameters' )|
|
||||
|PICK|<CURSOR>
|
||||
== ENDTEMPLATE ==
|
||||
|
@@ -0,0 +1,79 @@
|
||||
§ =============================================================
|
||||
§ Statements
|
||||
§ =============================================================
|
||||
|
||||
== Statements.case == map:sc, shortcut:c ==
|
||||
case <CURSOR> in
|
||||
)
|
||||
;;
|
||||
|
||||
)
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
|
||||
esac # --- end of case ---
|
||||
== Statements.elif == map:sei, shortcut:e ==
|
||||
elif <CURSOR> ; then
|
||||
== Statements.for-in == map:sf, shortcut:f ==
|
||||
for <CURSOR> in ; do
|
||||
<SPLIT><-LOOP_BODY->
|
||||
done
|
||||
== Statements.for == map:sfo, shortcut:f ==
|
||||
for (( CNTR=0; CNTR<<CURSOR>0; CNTR+=1 )); do
|
||||
<SPLIT><-LOOP_BODY->
|
||||
done
|
||||
== Statements.if == map:si, shortcut:i ==
|
||||
if <CURSOR> ; then
|
||||
<SPLIT><-IF_PART->
|
||||
fi
|
||||
== Statements.if-else == map:sie, shortcut:i ==
|
||||
if <CURSOR> ; then
|
||||
<SPLIT><-IF_PART->
|
||||
else
|
||||
<+ELSE_PART+>
|
||||
fi
|
||||
== Statements.select == map:ss, shortcut:s ==
|
||||
select <CURSOR> in ; do
|
||||
<SPLIT>done
|
||||
== Statements.until == map:su, shortcut:u ==
|
||||
until <CURSOR> ; do
|
||||
<SPLIT>done
|
||||
== Statements.while == map:sw, shortcut:w ==
|
||||
while <CURSOR> ; do
|
||||
<SPLIT>done
|
||||
== Statements.function == map:sfu, shortcut:f ==
|
||||
function |?FUNCTION_NAME| ()
|
||||
{
|
||||
<CURSOR><SPLIT>
|
||||
} # ---------- end of function |FUNCTION_NAME| ----------
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
§ -------------------------------------------------------------
|
||||
|
||||
== SEP: Statements.sep-print ==
|
||||
|
||||
== Statements.echo == insert, map:se, shortcut:e ==
|
||||
echo -e "<CURSOR><SPLIT>"
|
||||
== Statements.printf == insert, map:sp, shortcut:p ==
|
||||
printf "%s\n" <CURSOR><SPLIT>
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
§ -------------------------------------------------------------
|
||||
|
||||
== SEP: Statements.sep-array ==
|
||||
|
||||
== Statements.array element == insert, map:sae, shortcut:a ==
|
||||
${<CURSOR><SPLIT>[]}
|
||||
== Statements.array elements, all == insert, map:saa, shortcut:a ==
|
||||
${<CURSOR><SPLIT>[@]}
|
||||
== Statements.array elements, string == insert, map:sas, shortcut:s ==
|
||||
${<CURSOR><SPLIT>[*]}
|
||||
== Statements.subarray == insert, map:ssa, shortcut:s ==
|
||||
${<CURSOR><SPLIT>[@]::}
|
||||
== Statements.no of element == insert, map:san, shortcut:n ==
|
||||
${#<CURSOR><SPLIT>[@]}
|
||||
== Statements.array indices== insert, map:sai, shortcut:i ==
|
||||
${!<CURSOR><SPLIT>[@]}
|
||||
== ENDTEMPLATE ==
|
@@ -0,0 +1,86 @@
|
||||
§ =============================================================
|
||||
§ Tests
|
||||
§ =============================================================
|
||||
|
||||
== LIST: TestsArithmetic == hash ==
|
||||
'arg1 is equal to arg2, -eq' : '-eq',
|
||||
'arg1 not equal to arg2, -ne' : '-ne',
|
||||
'arg1 less than arg2, -lt' : '-lt',
|
||||
'arg1 less than or equal to arg2, -le' : '-le',
|
||||
'arg1 greater than arg2, -gt' : '-gt',
|
||||
'arg1 greater than or equal to arg2, -ge' : '-ge',
|
||||
== ENDLIST ==
|
||||
|
||||
== Tests.arithmetic tests == expandmenu, insert, sc:a, map:ta ==
|
||||
|PickList( 'arithmetic tests', 'TestsArithmetic' )|
|
||||
[ <CURSOR> |PICK| ]
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
== LIST: TestsFilePermission == hash ==
|
||||
'readable, -r' : '-r',
|
||||
'writable, -w' : '-w',
|
||||
'executable, -x' : '-x',
|
||||
'SUID-bit is set, -u' : '-u',
|
||||
'SGID-bit is set, -g' : '-g',
|
||||
'sticky bit is set, -k' : '-k',
|
||||
== ENDLIST ==
|
||||
|
||||
== Tests.file permissions == expandmenu, insert, sc:p, map:tfp ==
|
||||
|PickList( 'file permission', 'TestsFilePermission' )|
|
||||
[ <CURSOR> |PICK| ]
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
== LIST: TestsFileTypes == hash ==
|
||||
'block special file, -b' : '-b',
|
||||
'character special file, -c' : '-c',
|
||||
'directory, -d' : '-d',
|
||||
'named pipe (FIFO), -p' : '-p',
|
||||
'regular file, -f' : '-f',
|
||||
'socket, -S' : '-S',
|
||||
'symboloc link, -L, -h' : '-L',
|
||||
== ENDLIST ==
|
||||
|
||||
== Tests.file types == expandmenu, insert, sc:t, map:tft ==
|
||||
|PickList( 'file type', 'TestsFileTypes' )|
|
||||
[ <CURSOR> |PICK| ]
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
== LIST: TestsFileCharacteristics == hash ==
|
||||
'file exists, -e, -a' : '-e',
|
||||
'file exists, size greater zero, -s' : '-s',
|
||||
'file exists, owned by eff UID, -O' : '-O',
|
||||
'file exists, owned by eff GID, -G' : '-G',
|
||||
'file exists, modified since last read, -N' : '-N',
|
||||
'file1 newer than file2, -nt' : '-nt',
|
||||
'file1 older than file2, -ot' : '-ot',
|
||||
'files have same device and inode numbers , -ef' : '-ef',
|
||||
== ENDLIST ==
|
||||
|
||||
== Tests.file characteristics == expandmenu, insert, sc:c, map:tfc ==
|
||||
|PickList( 'file characteristics', 'TestsFileCharacteristics' )|
|
||||
[ <CURSOR> |PICK| ]
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
== LIST: TestsStrings == hash ==
|
||||
'length is zero, -z' : '-z',
|
||||
'length is non-zero, -n' : '-n',
|
||||
'strings are equal, ==' : '==',
|
||||
'strings are not equal, !=' : '!=',
|
||||
'sorts before, <' : '<',
|
||||
'sorts after, >' : '>',
|
||||
== ENDLIST ==
|
||||
|
||||
== Tests.string comparison == expandmenu, insert, sc:s, map:ts ==
|
||||
|PickList( 'string comparisons', 'TestsStrings' )|
|
||||
[ <CURSOR> |PICK| ]
|
||||
== ENDTEMPLATE ==
|
||||
|
||||
== Tests.option is enabled, -o == insert, map:toe, sc:o ==
|
||||
[ -o <CURSOR> ]
|
||||
== Tests.variable has been set, -v == insert, map:tvs, sc:v ==
|
||||
[ -v <CURSOR> ]
|
||||
== Tests.file descriptor is open, refers to a terminal, -t == insert, map:tfd, sc:d ==
|
||||
[ -t <CURSOR> ]
|
||||
== Tests.string matches regexp == insert, map:tm, sc:m ==
|
||||
[[ <CURSOR> =~ ]]
|
||||
== ENDTEMPLATE ==
|
Reference in New Issue
Block a user