- bat : a cat replacement
- ripgrep : grep recursively and ignoring your .gitignore
https://github.com/sharkdp/bat
https://github.com/sharkdp/bat
https://github.com/koalaman/shellcheck
check-scripts:
# Fail if any of these files have warnings
shellcheck myscripts/*.sh
or this on your CI (here : .travis.yml )script:
# Fail if any of these files have warnings
- shellcheck myscripts/*.sh
an old post found back on disqr about rsync (original date : circa 2016)
You might want to use the rsync exclude options directly in your script either by specifying a file with all the exclusions to perform, or by specifying them in the command line directly :
--exclude-from <file-name with 1 pattern by line>
--exclude <file or="" dir="">
For example :
One important thing to keep in mind when excluding a directory is that rsync will always consider the path to be relative to the source directory.
This can be used for example when you want to push your production from a Production JIRA instance to a Staging JIRA instance, but your dbconfig.xml is different (different DB auth parameters for example), and hence want to avoid some files.
cmd1 || cmd2 exec cmd2 if cmd1 fail cmd1 && cmd2 exec cmd2 if cmd1 is OK V1=${V2:=V3} Set V1 with the value of V2 if this is set else set the variable V1 with value of V3 (V3 could be a number). sh replacement: if [ $V2 ] ; then V1=$V2 else V1=$V3 Example: DisplaySize=${LINES:24} ; Command=${Command:"cat"} ${V1:?word} if V1 set & V1!=null ret $V1 else print word and exit : ${V1:?"variable V1 not set on null"} ${V1:=word} if V1 !set | V1==null set V1=$word ${V1:-word} if V1 set & V1!=null ret $V1 else ret word ${V1:+word} if V1 set & V1!=null ret word else ret nothing ${V1##patt} ${V1#patt} if patt are found at the begin of V1 return V1 whitout the patt else return V1 V1="lspwd" ; ${V1#"ls"} # exec pwd ${V1%%patt} ${V1%patt} if patt are found at the end of V1 return V1 whitout the patt else return V1 V1="lspwd" ; ${V1%"pwd"} # exec ls
from : http://www.well.ox.ac.uk/~johnb/comp/unix/ksh.html
# echo $- ismC # set -x # echo $- + echo isxmC isxmC # set +x
Parameters Set by Shell - Flags supplied to the shell on invocation or by the set command. set [ _abCefhkmnopstuvx ] [ _o option ]... [ _A name ] [ arg ... ] The flags for this command have meaning as follows: -A Array assignment. Unsets the variable name and assigns values sequentially from the list arg. If +A is used, the variable name is not unset first. -a All subsequent variables that are defined are automatically exported. -b Causes the shell to notify the user asyn- chronously of background job completions. The following message is written to standard error: "[%d]%c %s%s\n",, , , \ where the fields are as follows: The character + identifies the job that would be used as a default for the fg or bg utilities. This job can also be specified using the job_id %+ or %%. The charac- ter - identifies the job that would become the default if the current default job were to exit; this job can also be speci- fied using the job_id %-. For other jobs, this field is a space character. At most one job can be identi- fied with + and at most one job can be identified with -. If there is any suspended job, then the current job is a suspended job. If there are at least two suspended jobs, then the previous job is also a suspended job. A number that can be used to identify the process group to the wait, fg, bg, and kill utilities. Using these utilities, the job can be identified by prefixing the job number with %. Unspecified. Unspecified. When the shell notifies the user a job has been completed, it can remove the job's pro- cess ID from the list of those known in the current shell execution environment. Asyn- chronous notification is not enabled by default. -C Prevents existing files from being overwrit- ten by the shell's > redirection operator. The >| redirection operator overrides this noclobber option for an individual file. -e If a command has a non-zero exit status, executes the ERR trap, if set, and exit. This mode is disabled while reading pro- files. -f Disables file name generation. -h Each command becomes a tracked alias when first encountered. -k All variable assignment arguments are placed in the environment for a command, not just those that precede the command name. -m Background jobs runs in a separate process group and a line prints upon completion. The exit status of background jobs is reported in a completion message. On systems with job control, this flag is turned on automati- cally for interactive shells. -n Reads commands and check them for syntax errors, but do not execute them. Ignored for interactive shells. -o Writes the current option settings to stan- dard output in a format that is suitable for reinput to the shell as commands that achieve the same option settings. -o The following argument can be one of the following option names: allexport Same as -a. errexit Same as -e. bgnice All background jobs are run at a lower priority. This is the default mode. emacs Puts you in an emacs style in-line editor for command entry. gmacs Puts you in a gmacs style in- line editor for command entry. ignoreeof The shell does not exit onEOF. The command exit must be used. keyword Same as -k. markdirs All directory names resulting from file name generation have a trailing / appended. monitor Same as -m. noclobber Prevents redirection > from truncating existing files. Require >| to truncate a file when turned on. Equivalent to -C. noexec Same as -n. noglob Same as -f. nolog Do not save function defini- tions in history file. notify Equivalent to -b. nounset Same as -u. privileged Same as -p. verbose Same as -v. trackall Same as -h. vi Puts you in insert mode of a vi style in-line editor until you hit escape character 033. This puts you in control mode. A return sends the line. viraw Each character is processed as it is typed in vi mode. xtrace Same as -x. If no option name is supplied, the current option settings are printed. -p Disables processing of the $HOME/.profile file and uses the file /etc/suid_profile instead of the ENV file. This mode is on whenever the effective uid is not equal to the real uid, or when the effective gid is not equal to the real gid. Turning this off causes the effective uid and gid to be set to the real uid and gid. -s Sorts the positional parameters lexicograph- ically. -t Exits after reading and executing one com- mand. -u Treats unset parameters as an error when substituting. -v Prints shell input lines as they are read. -x Prints commands and their arguments as they are executed. - Turns off -x and -v flags and stops examin- ing arguments for flags. -- Does not change any of the flags. Useful in setting $1 to a value beginning with -. If no arguments follow this flag then the posi- tional parameters are unset. Using + rather than - causes these flags to be turned off. These flags can also be used upon invocation of the shell. The current set of flags can be found in $-. Unless -A is specified, the remaining arguments are positional parameters and are assigned, in order, to $1 $2 .... If no arguments are given, the names and values of all variables are printed on the standard output.
find ./ -name "*.logfile" | xargs -i mv '{}' /my/really/great/implementation_scripts/log_directory/
(cf : http://bturnip.com/weblog/?p=248 )
or :
STTY(1) User Commands STTY(1) NAME stty - change and print terminal line settings SYNOPSIS stty [-F DEVICE | --file=DEVICE] [SETTING]... stty [-F DEVICE | --file=DEVICE] [-a|--all] stty [-F DEVICE | --file=DEVICE] [-g|--save] DESCRIPTION Print or change terminal characteristics.
$ stty -a speed 38400 baud; rows 40; columns 80; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc ixany imaxbel iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprtDonc en fait "^d" envoie un "eof", pas un sig_quit...