shlibs 1.3.35 Documentation

shlibs App

shlibs App Options

shlibs -reset

Performs a reset of shlibs app. At the moment the settings are restored to their default values.

shlibs -h

Shows the help section of shlibs app.

shlibs -x

Shows the examples section of shlibs app.

shlibs -s /path/to/sh/script

Processes script performing an interactive replacement of shlibs instances found based on user selection. At the end of operation a cross-OS structure is generated. The options below can only be used with -s :

  • shlibs -s /path/to/sh/script1 -s /path/to/sh/script2 -s /path/to/sh/scriptn
    • process multiple scripts in one go
    • output in the same folder at the location of last indicated script
  • shlibs -s /path/to/sh/script -d /destination/folder
    • process script and output to indicated folder
  • shlibs -s /path/to/sh/script -d /destination/folder -clean
    • process script and output to indicated folder after removing previous content found in it
  • shlibs -s /path/to/sh/script -y
    • runs a realistic test of output script after processing

shlibs Libraries

General libraries options

  • Call: shlibs libcode
  • Help: shlibs -h libcode
  • Examples: shlibs -x libcode
  • Path: shlibs -p libcode

shlibs Libraries Details

shlibs dir001

  • Help:
    Recursively empties and removes directory or file
    ${@} – Path(s) to be removed
  • Examples:
    shlibs dir001 “/path/to/be/removed” “/other/path” …
    echo ${?}
    Success: 0
    Fail: 1

shlibs file001

  • Help:
    Checks if two files have the same content (+-case insensitive)
    Parameters:
     – path of the first file
     – path of the second file
     – case insensitive comparison “-i” (optional)
    Returns 0 (test passed), 1 (test failed), or 2 (errors)
  • Examples:
    shlibs file001 “$(shlibs -p tst006)” “$(shlibs -p tst007)” -i
    echo “${?}”
    Result: 0

shlibs file002

  • Help:
    Create a temporary file and return the path to it.
    It is highly recommended to cleanup your temporary files when done!
    Parameters:
     – use -path to change destination (default ${SHLIBS_HOME}/var/tmp/)
     – use digits to set the length of tmp file name (default 16, max 32)
  • Examples:
    tmpfile=”$(shlibs file002)”
    # ops involving $tmpfile
    # cleanup
    rm “${tmpfile}”

shlibs file003

  • Help:
    Checks if a file ends with new line (option to append new line)
    Parameters:
     – path of the file to be tested
     – use “-y” to append a new line if missing from the end of the file
    Returns 0 (test passed), 1 (test failed), or 2 (errors)
  • Examples:
    shlibs file003 “${testfile}”
    echo ${?}
    # 0 if the file is missing a new line at the end
    # 1 if the file ends with a new line

shlibs htm001

  • Help:
    Inserts (X)HTML line breaks at each new line in string/file
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – use “-xhtml” to insert <br> instead of <br /> (optional)
     – use “-skipempty” to keep empty lines intact (optional)
  • Examples:
    shlibs htm001 -f “$(shlibs -p tst006)” -xhtml
    Result:
    needle<br />
    right

shlibs mth001

  • Help:
    Checks and returns given integer in given interval
    $1 – Subject integer
    $2 – Lower limit (integer)
    $3 – Upper limit (integer)
  • Examples:
    int1=$(shlibs mth001 10 27 100)
    int2=$(shlibs mth001 78 3 22)
    echo “$int1, $int2”
    Result:
    27, 22

shlibs mth002

  • Help:
    Returns the integer with the minimum value.
    Requires at least 2 integers.
  • Examples:
    min=$(shlibs mth002 23 3 5 23 65 2)
    echo “minimum: $min”
    Result:
    minimum: 2

shlibs mth003

  • Help:
    Returns the integer with the maximum value.
    Requires at least 2 integers.
  • Examples:
    max=$(shlibs mth003 23 3 5 23 65 2)
    echo “maximum: $max”
    Result:
    maximum: 65

shlibs mth004

  • Help:
    Performs arithmetic calculations. Outputs integer/float values.
    Parameters: 
     – string describing the calculation to be performed
     – use “-fmt format” to describe the output format (optional, default “%.6g”)
       (non-standard output formats can fail on some versions of awk/OSes; 
        i.e. “%.4d” will fail on nawk/Solaris, awk/Minix
        while standard formats such as “%.4g” and “%.4f” will never fail)
  • Examples:
    shlibs mth004 “400*2.434/873”
    shlibs mth004 “400*2.434/873” -fmt “%.2f”
    Results:
    1.11523
    1.12

shlibs ofc001

  • Help:
    1.3.35
  • Examples:
    1.3.35

shlibs ofc002

  • Help:
    1.1.40
  • Examples:
    1.1.40

shlibs ofc003

  • Help:
    shlibs Changelog
    When no parameters specified shows the latest shlibs Changelog.
    Parameters:
     – use 0 to show the complete changelog (optional)
     – use # to show the changelog for release (optional)
  • Examples:
    # latest changelog
    shlibs ofc003
    # specific changelog (for release 2 of shlibs)
    shlibs ofc003 2
    # all the changelogs
    shlibs ofc003 0

shlibs ofc004

  • Help:
    Outputs a list of shlibs official library codes
  • Examples:
    shlibs ofc004
    Result: 
    str001 str002 str003 …

shlibs ofc005

shlibs perltst001

  • Description:
    No Description.

shlibs phptst001

  • Description:
    No Description.

shlibs pytst001

  • Description:
    No Description.

shlibs str001

  • Help:
    Checks if string/file contains needle.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – the needle
     – use “-i” for case insensitive search (optional)
     – start index (integer, included, 1 based, optional, can be negative).
     – end index (integer, included, 1 based, optional, can be negative).
    Returns 0 (test passed), 1 (test failed), or 2 (errors)
  • Examples:
    txt=”A test string containing needle and other stuff.”
    shlibs str001 “${txt}” “needle”
    echo ${?}
    Result: 0 (success)

shlibs str002

  • Help:
    Trim extra whitespace from string.
    Parameters:
    $@ – String(s)
  • Examples:
    string=”    27262976   kB     “
    string_trimmed=$(shlibs str002 “${string}”)
    echo “${string_trimmed}”
    Result:
    27262976 kB

shlibs str003

  • Help:
    Returns the first n characters in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – the number of chars to return
       (if more then one integer, the last one is taken into account as size)
  • Examples:
    string=$(printf “%b” “This is the first line.\\nSecond line here.\\nThird one here.”)
    string_left_28=$(shlibs str003 “${string}” 28)
    echo “${string_left_28}”
    Result:
    “This is the first line.
    Seco”

shlibs str004

  • Help:
    Returns the last n characters in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – the number of chars to return
  • Examples:
    string=$(printf “%b” “This is the first line.\\nSecond line here.\\nThird one here.”)
    string_right_26=$(shlibs str004 “${string}” 26)
    echo “${string_right_26}”
    Result:
    “line here
    Third one here.”

shlibs str005

  • Help:
    Generates random characters.
    Maximum 5 optional parameters, any order:
     – generated string length (default 16)
     – (x)a options – (exclude) lowercase letters (default include -a)
     – (x)A options – (exclude) uppercase letters (default include -A)
     – (x)d options – (exclude) digits (default include -d)
     – (x)p options – (exclude) punctuation (default exclude -xp)
  • Examples:
    shlibs str005    (exclude punctuation, 16 chars)
    YdadcjB55r56q9eC
    shlibs str005 10 -p -xA    (10 chars, include punctuation, exclude uppercase)
    %e<c8}5grd
    shlibs str005 20 -xd    (20 chars, exclude digits)
    dEEjpAPvNXAkdFKkwcjJ

shlibs str006

  • Help:
    Split string/file by sequence and return slice at index.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – sequence splitting the string (follows the string above)
     – slice index, 1 based (can be negative i.e. -1 for last slice)
     – use “-i” for case insensitive search and deletion (optional)
  • Examples:
    txt=”The text to be split and slice served.”
    shlibs str006 “${txt}” ” ” 2
    Result: text

shlibs str007

  • Help:
    Returns the character at specified index in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – slice index, 1 based (can be negative e.g. -1 i.e. last slice)
  • Examples:
    teststring=”CharAt eXample!”
    shlibs str007 “${teststring}” 9
    Result: X
    shlibs str007 “${teststring}” -7
    Result: X

shlibs str008

  • Help:
    Concatenate/glue two or more strings (optional use characters to glue).
    Parameters:
     – minimum 2 strings to glue
     – optional, use “-s glue_chars” to glue the strings using “glue_chars”
       (use “-s glue_chars” before any other strings)
  • Examples:
    shlibs str008 “The first part” “, the second part” “…” “, n-th part.”
    Result: 
    The first part, the second part…, n-th part.

shlibs str009

  • Help:
    Checks if string ends with the characters of another string.
    Parameters:
     – reference string/file
     – test characters (end string, needle, ERE less s/c ^ and $)
     – case insensitive search flag “-i” (optional)
    Returns 0 (test passed), 1 (test failed), or 2 (errors)
  • Examples:
    txt=”A nice text with needle and other stuff.”
    shlibs str009 “${txt}” “stuff.”
    echo ${?}
    Result: 0

shlibs str010

  • Help:
    Returns absolute index of the first occurrence of needle in string/file.
    (returns 0 if not found)
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – needle, search substring
     – case insensitive search flag “-i” (optional)
     – start position (optional, 1 based, can be negative)
  • Examples:
    shlibs str010 “A nice text with needle, stuff, and extra needles.” “needle”
    Result: 18

shlibs str011

  • Help:
    Returns index of the last occurrence of needle in string/file.
    (returns 0 if not found)
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – needle, search substring
     – case insensitive search flag “-i” (optional)
     – end position (optional, 1 based, can be negative)
  • Examples:
    shlibs str011 “A nice text with needle, stuff, and extra needles.” “needle”
    Result: 43

shlibs str012

  • Help:
    Repeat character or sequence n times.
    Parameters:
     – string used for multiplication
     – multiplication factor (integer greater than 1)
  • Examples:
    shlibs str012 “*” 12
    Result:
    ************

shlibs str013

  • Help:
    Pads end of string/file with sequence until length is reached.
    Parameters:
     – base string
     – padding string (must be specified after the base string)
     – target length
  • Examples:
    teststring=$(shlibs str013 “Base string” “.” 24)
    echo “${teststring}”
    echo “length: ${#teststring}”
    Results: 
    Base string………….
    length: 24

shlibs str014

  • Help:
    Pads front of string/file with sequence until length is reached.
    Parameters:
     – base string
     – padding string (must be specified after the base string)
     – target length
  • Examples:
    teststring=$(shlibs str014 “base string” “.” 24)
    echo “${teststring}”
    echo “length: ${#teststring}”
    Results: 
    ………….base string
    length: 24

shlibs str015

  • Help:
    Replace sequence in string/file (first instance or global).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – sequence to replace
     – replacement string
     – use “-g” to replace all instances of the sequence (optional)
     – use “-i” for case insensitive search and replacement (optional)
  • Examples:
    teststring=$(printf “%b” “This is the >>first<< line.\\n\\nSecond .?=line..,, here.\\nThird% #%li,ne-from-aliens.k; here.”)
    shlibs str015 -g “${teststring}” “line” “transmission”
    Result: 
    This is the >>first<< transmission.

    Second .?=transmission..,, here.
    Third% #%li,ne-from-aliens.k; here.

shlibs str016

  • Help:
    Returns portion of string/file between index1 and index2 (end).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – start index (1 based, included, can be negative)
     – end index (optional, 1 based, included, can be negative)
       (indexes can swap position)
  • Examples:
    teststring=”A test string used to test shlibs str016″
    shlibs str016 “${teststring}” -7 8
    Result:
    string used to test shlibs 

shlibs str017

  • Help:
    Checks if string/file starts with another string.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – test characters (start string, needle, ERE less s/c ^ and $)
     – case insensitive search flag “-i” (optional)
    Returns 0 (test passed), 1 (test failed), or 2 (errors)
  • Examples:
    txt=”A nice text with needle and other stuff.”
    shlibs str017 “${txt}” “A nice”
    echo ${?}
    Success: 0
    Fail: 1

shlibs str018

  • Help:
    Returns portion of string/file defined by start and length (end).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – start index (1 based, included, can be negative)
     – length (optional, integer, 1 based, included, positive)
  • Examples:
    teststring=”A test string used to test shlibs str018″
    shlibs str018 “${teststring}” 28 6
    Result: shlibs

shlibs str019

  • Help:
    Replaces portion of string/file defined by start and length(end).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – start index (1 based, included, can be negative)
     – length (optional, integer, 1 based, included, positive)
     – replacement string
  • Examples:
    teststring=”A test string used to test shlibs str019″
    shlibs str019 “${teststring}” -18 4 “prove replacement using”
    Result: 
    A test string used to prove replacement using shlibs str019

shlibs str020

  • Help:
    Returns the lower case version of given string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shlibs str020 “TEXT to CHANGE to lowercase”
    Result:
    text to change to lowercase

shlibs str021

  • Help:
    Returns the upper case version of given string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shlibs str021 “text TO change to UPPERCASE”
    Result:
    TEXT TO CHANGE TO UPPERCASE

shlibs str022

  • Help:
    Trim whitespace from the beginning of string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    result=$(shlibs str022 ”   trim left   whitespace subject  string  “)
    echo “>>${result}<<“
    Result:
    >>trim left   whitespace subject  string  <<

shlibs str023

  • Help:
    Trim whitespace from the end of string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    result=$(shlibs str023 ”  trim right   whitespace subject  string   “)
    echo “>>${result}<<“
    Result:
    >>  trim right   whitespace subject  string<<

shlibs str024

  • Help:
    Count occurrences of needle in string.
    Maximum 5 parameters, any order
    $1 – Subject string
    $2 – Needle, search substring
    $3 – Case insensitive search flag “-i” (optional)
    $4 – Start index (integer, included, 1 based, optional, can be negative).
    $5 – End index (integer, included, 1 based, optional, can be negative).
  • Examples:
    teststring=”A test string containing needle, needle, needle and needle.”
    shlibs str024 “${teststring}” “needle”
    Result: 4

shlibs str025

  • Help:
    UpperCase the first single character of a whole string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shlibs str025 “make the first char in this string upper case (M).”
    Result:
    Make the first char in this string upper case (M).

shlibs str026

  • Help:
    Fold/wrap string/file to specified size (align left).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – wrap size (first integer supplied is taken as wrap size)
     – use -b to break words (optional)
  • Examples:
    shlibs str026 “A string used to test wrapping of text with shlibs str026” 24
    Result: 
    A string used to test
    wrapping of text with
    shlibs str026

shlibs str027

  • Help:
    Returns the total number of characters in string/file.
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shlibs str027 “test string”
    Result: 11

shlibs str028

  • Help:
    LowerCase the first single character of a whole string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shlibs str028 “MAKE the First Char in This String Lower Case (m).”
    Result:
    mAKE the First Char in This String Lower Case (m).

shlibs str029

  • Help:
    Delete (or delete all except) classes of chars, or chosen chars.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – use “-alnum” to delete letters and numbers (-kalnum to keep them)
     – use “-alpha” to delete letters (-kalpha to keep them)
     – use “-blank” to delete blanks (-kblank to keep them)
     – use “-cntrl” to delete control characters (-kcntrl to keep them)
     – use “-digit” to delete numbers (-kdigit to keep them)
     – use “-graph” to delete graphical characters (-kgraph to keep them)
     – use “-lower” to delete lowercase characters (-klower to keep them)
     – use “-print” to delete printable characters (-kprint to keep them)
     – use “-punct” to delete punctuation characters (-kpunct to keep them)
     – use “-space” to delete whitespace characters (-kspace to keep them)
     – use “-upper” to delete uppercase characters (-kupper to keep them)
     – use “-xdigit” to delete hexadecimal notation chars (-kxdigit to keep them)
     – use “–chars_to_del” to delete chars (“–kchars_to_del” to keep them)
  • Examples:
    result=$(shlibs str029 “abcd%^&*#.,ABCD1234567890” -punct)
    echo “${result}”
    Result: abcdABCD1234567890
    result=$(shlibs str029 “abcd%^&*#.,ABCD1234567890” –aAdD123\&)
    echo “${result}”
    Result: bc%^*#.,BC4567890

shlibs str030

  • Help:
    Delete from output empty lines in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    teststring=$(printf “%b” “This is the >>first<< line.\\n\\nSecond .?=line..,, here.\\nThird% #%li,ne-from-aliens.k; here.”)
    shlibs str030 “${teststring}”
    Result: 
    This is the >>first<< line.
    Second .?=line..,, here.
    Third% #%li,ne-from-aliens.k; here.

shlibs str031

  • Help:
    Output shuffled characters of string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shuffled=$(shlibs str031 “string to shuffle”)
    echo “>>${shuffled}<<“
    Result:
    >>uoheifssnrftg l t<<

shlibs str032

  • Help:
    Count words in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – use “-interpret” to detect and count contractions such as “that`s”
  • Examples:
    shlibs str032 “A test string used to test str032.”
    Result: 7

shlibs str033

  • Help:
    Reverse order of lines in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    string=$(printf “%b” “This is the first line.\\nSecond line here.\\nThird one here.”)
    shlibs str033 “${string}”
    Result: 
    Third one here.
    Second line here.
    This is the first line.

shlibs str034

  • Help:
    Returns substring needle until end, or start until needle.
    (returns 1 if not found)
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – needle, search substring
     – use “-fwd” to output portion beginning until needle
     – case insensitive search flag “-i” (optional)
     – start position (optional, 1 based, can be negative)
  • Examples:
    shlibs str034 “A nice text with needle, stuff, and extra needles.” “needle”
    Result: 
    needle, stuff, and extra needles.

shlibs str035

  • Help:
    Returns index of the n-th occurrence of needle in string.
    (returns 0 if not found, or if n exceeds the number of occurences)
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – needle, search substring
     – sequential number of the occurrence (1 based, positive)
     – case insensitive search flag “-i” (optional)
  • Examples:
    shlibs str035 “A text with needle, needle, needle, stuff, and extra needles.” “needle” 3
    Result: 29

shlibs str036

  • Help:
    Translate characters in string/file.
    Parameters ordered as follows:
     – subject string, or “-f /path/to/text/file” to process file content
     – targeted characters
     – translation characters
    (“abc” “xyz”, will translate “a” to “x”, “b” to “y” and “c” to “z”)
  • Examples:
    teststring=”A test string used to test str036″
    shlibs str036 “${teststring}” “gue” “GU “
    Result: 
    A t st strinG Us d to t st str036

shlibs str037

  • Help:
    Uppercase first letter of each word in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shlibs str037 “A string used to test shlibs str037.”
    Result: 
    A String Used To Test Shlibs Str037.

shlibs str038

  • Help:
    Delete sequence from string/file (options: global, case insensitive).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – sequence to delete (if above is string, the sequence must follow it)
     – use “-g” to delete all instances of the sequence (optional)
     – use “-i” for case insensitive search and deletion (optional)
  • Examples:
    teststring=$(printf “%b” “This is the >>first<< line.\\n\\nSecond .?=line..,, here.\\nThird% #%li,ne-from-aliens.k; here.”)
    shlibs str038 “${teststring}” “line”
    Result: 
    This is the >>first<< .
     
    Second .?=line..,, here.
    Third% #%li,ne-from-aliens.k; here.

shlibs str039

  • Help:
    Lowercase first letter of each word in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shlibs str039 “A TesT StrinG UseD To TesT ShlibS Str039.”
    Result: 
    a tesT strinG useD to tesT shlibS str039.

shlibs str040

  • Help:
    Count bytes in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shlibs str040 “A test string used to test shlibs str040.”
    Result: 42

shlibs str041

  • Help:
    Count newlines in string/file.
    Parameters:
    Subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    string=$(printf “%b” “This is the first line.\\nSecond line here.\\nThird one here.”)
    shlibs str041 “${string}”
    Result: 3

shlibs str042

  • Help:
    Return lines in interval start-end of string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – start line number (included in output)
     – end line number (included in output)
  • Examples:
    string=$(printf “%b” “This is the first line.\\n\\nSecond line here.\\nExemplary line coming up.\\n\\nAnother one here.”)
    shlibs str042 “${string}” 3 4
    Result: 
    Second line here.
    Exemplary line coming up.

shlibs str043

  • Help:
    Return lines in interval start-length of string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – start, line number of the start of deletion (deleted as well)
     – length, the total number of lines to be deleted
       (must be specified after start line number)
  • Examples:
    string=$(printf “%b” “This is the first line.\\n\\nSecond line here.\\nExemplary line coming up.\\n\\nAnother one here.”)
    shlibs str043 “${string}” 3 2
    Result: 
    Second line here.
    Exemplary line coming up.

shlibs str044

  • Help:
    Checks if two strings are equal (+case insensitive option).
    Parameters:
     – first string
     – second string
     – case insensitive search flag “-i” (optional)
    Returns 0 (test passed), 1 (test failed), or 2 (errors)
  • Examples:
    shlibs str044 “Base String” “base string” -i
    echo ${?}
    Result: 0

shlibs str045

  • Help:
    Checks if string/file is empty.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
    Returns 0 (test passed), 1 (test failed), or 2 (errors)
  • Examples:
    shlibs str045 “”
    echo ${?}
    Result: 0

shlibs str046

  • Help:
    Reverse order of chars in string/file (+-keep order of lines).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – use “-kol” to keep the order of lines (optional)
  • Examples:
    string=$(printf “%b” “This is the >>first<< line.\\n\\nSecond .?=line..,, here.\\nThird% #%li,ne-from-aliens.k; here.”)
    shlibs str046 “${string}”
    Result: 
    here. #%li,ne-from-aliens.k; Third%
    here. .?=line..,, Second

    line. >>first<< the is This

shlibs str047

  • Help:
    Outputs string/file content after inserting sequence at index.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – sequence, substring to be inserted
     – index of insertion (1 based, can be negative)
  • Examples:
    shlibs str047 “$(shlibs tst003)” “www.shlibs.org ” 3
    Result: 
    A www.shlibs.org Test needle line with needles, stuff, needle and once more Needle. Needles all over.

shlibs str048

  • Help:
    Returns maximum line length in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shlibs str048 “$(shlibs tst002)”
    Result: 54

shlibs str049

  • Help:
    Append string forward of the first specified string (prepend).
    Parameters:
     – base string
     – string to prepend
  • Examples:
    shlibs str049 “rocks” “^^” “shlibs “
    Result:
    ^^ shlibs rocks

shlibs str050

  • Help:
    Justify format string/file (+-wrap to size and break words).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – wrap size (optional)
     – use -b to break words (optional, works when wrap size specified)
  • Examples:
    shlibs str050 “A string used to test wrap and justify text using str050” 21
    Result: 
    A string used to test
    wrap and justify text
    using str050

shlibs str051

  • Help:
    Align right string/file (+-wrap to size and break words).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – wrap size (optional)
     – use -b to break words (optional, works when wrap size specified)
  • Examples:
    shlibs str051 “A string used to test wrap and align right text using str051” 24
    Result: 
       A string used to test
        wrap and align right
           text using str051

shlibs str052

  • Help:
    Expands tabs to spaces (default 4 spaces per tab).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – integer to indicate the number of spaces per tab
       (optional, just the first integer supplied is taken into account)
  • Examples:
    shlibs str052 “$(printf “%b\n” “Text \\twith \\t\\ttabs\\t.”)” 8
    Result: 
    Text         with                 tabs        .

shlibs str053

  • Help:
    Return first n lines in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – the number of lines (optional, defaults to 10)
  • Examples:
    teststring=$(printf “%b” “This is the first line.\\nSecond line here.\\nThird one here.”)
    shlibs str053 “${teststring}” 2
    Result:
    This is the first line.
    Second line here.

shlibs str054

  • Help:
    Removes n characters from the end of the string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – the amount of chars to remove from end of string/file
  • Examples:
    shlibs str054 “A pretty short test string.” 19
    Result: 
    A pretty

shlibs str055

  • Help:
    Delete from output lines containing needle in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – needle (can be BRE i.e. “^\\(test\\|probe\\)\\(.\\)*$”)
  • Examples:
    string=$(printf “%b” “This is the >>first<< line.\\n\\nSecond .?=line..,, here.\\nThird% #%li,ne-from-aliens.k; here.”)
    shlibs str055 “${string}” aliens
    Result: 
    This is the >>first<< line.

    Second .?=line..,, here.

shlibs str056

  • Help:
    Removes n characters from the front of the string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – the amount of chars to remove from the front of string/file
  • Examples:
    shlibs str056 “A pretty short test string.” 19
    Result: string.

shlibs str057

  • Help:
    Center content of string/file (+-wrap to size and break words).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – wrap size (optional)
     – use -b to break words (optional, works when wrap size specified)
  • Examples:
    shlibs str057 “A string used to test wrap and center text using str057” 21
    Result: 
      A string used to   
    test wrap and center 
      text using str057  

shlibs str058

  • Help:
    Paragraph format string/file (+-wrap to size and break words).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – wrap size (optional)
     – use -b to break words (optional, works when wrap size specified)
     – use “-indent n” to add n spaces at the beginning of first line
       (optional, defaults to 4)
  • Examples:
    shlibs str058 “A string used to test paragraph format text using str058” 21
    Result: 
        A  string used to
    test paragraph format
    text using str058

shlibs str059

  • Help:
    Returns swapcase version of string/file (lowercase<->UPPERCASE)
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shlibs str059 “TEXT to MORPH using shlibs str059 SWAPCASE.”
    Result:
    text TO morph USING SHLIBS swapcase.

shlibs str060

  • Help:
    Reverse order of words in string/file (+-keep order of lines).
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – use “-kol” to keep the order of lines (optional)
     – use “-op” to reverse the order of punctuation as well (optional)
       (can output better results in some cases i.e. no paths in string)
  • Examples:
    string=$(printf “%b” “This is the >>first<< line.\\n\\nSecond .?=line..,, here.\\nThird% #%li,ne-from-aliens.k; here.”)
    shlibs str060 “${string}”
    Result: 
    here. #%li,ne-from-aliens.k; Third%
    here. .?=line..,, Second

    line. >>first<< the is This

shlibs str061

  • Help:
    Return last n lines in string/file.
    Parameters:
     – subject string, or …
     – text file: “-f /path/to/text/file”
     – the number of lines (optional, defaults to 10)
  • Examples:
    teststring=$(printf “%b” “This is the first line.\\nSecond line here.\\nThird one here.”)
    shlibs str061 “${teststring}” 2
    Result:
    Second line here.
    Third one here.

shlibs str062

  • Help:
    Delete from output lines in interval start-end of string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – start, line number of the start of deletion (deleted as well)
     – end, line number of the end of deletion (deleted as well)
  • Examples:
    string=$(printf “%b” “This is the first line.\\n\\nSecond line here.\\nExemplary line coming up.\\n\\nAnother one here.”)
    shlibs str062 “${string}” 2 4
    Result: 
    This is the first line.

    Another one here.

shlibs str063

  • Help:
    Titlecase check – words first letter is Uppercase in string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
  • Examples:
    shlibs str063 “A String Used To Test Shlibs Str063.”
    echo ${?}
    Result: 0

shlibs str064

  • Help:
    Delete from output lines in interval start-length of string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – start, line number of the start of deletion (deleted as well)
     – length, the total number of lines to be deleted
       (must be specified after start line number)
  • Examples:
    string=$(printf “%b” “This is the first line.\\n\\nSecond line here.\\nExemplary line coming up.\\n\\nAnother one here.”)
    shlibs str064 “${string}” 2 3
    Result: 
    This is the first line.

    Another one here.

shlibs str065

  • Help:
    Test string/file contains only (or no) classes of chars / chars
    (NO and YES tests can coexist)
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – use “-alnum” to pass if letters and numbers (-kalnum to fail)
     – use “-alpha” to pass if letters (-kalpha to fail)
     – use “-blank” to pass if blanks (-kblank to fail)
     – use “-cntrl” to pass if control characters (-kcntrl to fail)
     – use “-digit” to pass if numbers (-kdigit to fail)
     – use “-graph” to pass if graphical characters (-kgraph to fail)
     – use “-lower” to pass if lowercase characters (-klower to fail)
     – use “-print” to pass if printable characters (-kprint to fail)
     – use “-punct” to pass if punctuation characters (-kpunct to fail)
     – use “-space” to pass if whitespace characters (-kspace to fail)
     – use “-upper” to pass if uppercase characters (-kupper to fail)
     – use “-xdigit” to pass if hexadecimal notation chars (-kxdigit to fail)
     – use “–chars_to_look_for” to pass if chars (“–kchars_to_look_for” to fail)
    Returns 0 (test passed), 1 (test failed), or 2 (errors)
  • Examples:
    shlibs str065 “abcd%^&*#.,ABCD1234567890” -punct -alnum -kspace -kcntrl
    echo “${?}”
    Result: 0

shlibs str066

  • Help:
    Checks if region matches. Works on strings and/or files.
    Parameters:
     – first string, or “-f /path/to/text/file” to process file content
     – second string, or “-f /path/to/text/file” to process file content
     – region start index (1 based, included, can be negative)
     – region length (positive integer)
       (start/length should be specified in order above unless logical cases)
    Returns 0 (test passed), 1 (test failed), or 2 (errors)
  • Examples:
    teststring1=”A test string”
    teststring2=”A test string used to test shlibs str066″
    shlibs str066 “${teststring1}” “${teststring2}” 1 13
    echo ${?}
    Result: 0 (Successful match)

shlibs str067

  • Help:
    Returns the average number of chars per line of string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – use -skipempty to leave empty lines out of calculation (optional)
  • Examples:
    shlibs str067 “$(shlibs tst002)”
    Result:
    21.2353

shlibs str068

  • Help:
    Returns minimum number of chars per line of string/file.
    Parameters:
     – subject string, or “-f /path/to/text/file” to process file content
     – use -skipempty to leave empty lines out of calculation (optional)
  • Examples:
    shlibs str068 “$(shlibs tst002)”
    Result:
    21.2353

shlibs trm001

  • Help:
    Get cursor position in terminal (u.o.m. characters)
    (sets trm001_cursor_x and trm001_cursor_y)
    Usage:
     – get trm001 path using -p flag
     – source trm001 using the path obtained above
     – update cursor position by calling function “trm001”
     – important! “trm001” call result should be success (0)
     – use $trm001_cursor_x and $trm001_cursor_y in your script
     – see the examples “shlibs -x trm001”
  • Examples:
    # make sure you are not running on a C shell (BSDs -> exec /bin/sh)
    trm001_path=”$(shlibs -p trm001)”
    . “${trm001_path}”
    # below checks for the success of update operation
    if trm001 ; then
       echo “${trm001_cursor_x}”
       echo “${trm001_cursor_y}”
    fi
    Result: 
    1
    4

shlibs tst001

  • Help:
    Development utility used to test shlibs libraries.
    By default only the official libs are tested.
    Use library codes as arguments to test specific libraries from any category.
    If your OS is not listed on https://shlibs.org, https://shlibs.org, or
    if some tests fail, please send the results to the contacts above.
  • Examples:
    shlibs tst001 str015
    Result:
    Testing str015. Results: 2/2 (passed/total).
    ======================================================================
    Tested 1 libs. Tests passed 100% (2/2).

shlibs tst002

  • Help:
    Outputs multiline text: various types of chars.
    Parameters ignored.
  • Examples:
    shlibs tst002
    Result:
    This is multiline sample text

    You can use this File to Test various shlibs libraries

    It contains empty lines
     
    Lines with just a space char
    Punctuation chars: .,;^
    Numbers are present as well: 1967452186456

    Multiple tabs above
    UPPERCASE TEXT MAY BE USEFUL WHEN TESTING
    Titlecase Could Be Useful As Well


    Special control chars right here:   
    Whitespace chars here: 
     

shlibs tst003

  • Help:
    Outputs a single line of text used for tests.
    Parameters ignored.
  • Examples:
    shlibs tst003
    Result:
    A Test needle line with needles, stuff, needle and once more Needle. Needles all over.

shlibs tst004

  • Description:
    No Description.

shlibs tst005

  • Description:
    No Description.

shlibs tst006

  • Description:
    No Description.

shlibs tst007

  • Description:
    No Description.

shlibs tst008

  • Description:
    No Description.

shlibs tst009

  • Description:
    No Description.