_repeat() { #@ USAGE: _repeat string number _REPEAT=$1 while (( ${#_REPEAT} < $2 )) ## Loop until string exceeds desired length do _REPEAT=$_REPEAT$_REPEAT$_REPEAT ## 3 seems to be the optimum number done _REPEA
https://ryanstutorials.net/bash-scripting-tutorial/bash-if-statements.php https://stackoverflow.com/questions/4277665/how-do-i-compare-two-string-variables-in-an-if-statement-in-bash http://www.masteringunixshell.net/qa36/bash-how-to-add-to-array.html https://www.cyberciti.biz/faq/linux-u...
tmux_horizontal.sh - same as above but split horizontally tmux_square.sh - same as above but with 4 panes in a square tiled view urlencode.sh / urldecode.sh - URL encode/decode quickly on the command line, in pipes etc. urlextract.sh - extracts the URLs from a given string arg, file...
BASH_VERSION Expands to a string describing the version of this instance of bash. COMP_CWORD An index into ${COMP_WORDS} of the word containing the current cursor position. This variable is available only in shell functions invoked by the programmable completion facilities (see Programmable ...
When no array variable name is provided to the mapfile command, the input will be stored into the $MAPFILE variable. Note that the mapfile command will split by default on newlines character but will preserve it in the array values, you can remove the trailing delimiter using the -t ...
In the code above, we assign the string "hello world" to the variable var. .* will resolve all characters of the previous token (i.e. the value of var). Thus, with two identical operands, the comparison operator returns the total number of characters in the first operand. ...
(str-replace STRING FIND REPLACE)- Replace all occurrences of the stringFINDinSTRINGwith the stringREPLACE. (str-split STRING SPLIT-CHARACTER)- SplitSTRINGinto a list of strings on the single charactersSPLIT-CHARACTER. (str-pos HAYSTACK NEEDLE)- Returns the position of stringNEEDLEin stringHAYSTACK...
Bash provides a one-dimensional array variables. See also: When calling a function, quote the variable otherwise bash will not see the string as atomic. The separator is variable $IFS. There is: ... Bash - (Builtin|Intern|System|Reserved|Shell) variable name Reserved variable name are nam...
The sub- string value provides functionality analogous to the %? job identifier (see JOB CONTROL below). If set to any other value, the supplied string must be a prefix of a stopped job's name; this provides functionality analo- gous to the %string job identifier. histchars The two or...
Some options like -k or -D require a string to follow the option letter. The string for that option is considered to end when a dollar sign ($) is found. For example, you can set two -D options on MS-DOS like this: LESS="Dn9.1$Ds4.1" ...