Check-in [d6f691d449]
Not logged in
Overview
Comment:update to mmmv_Fossil_operator_t1.bash
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d6f691d449988776151161952b251e0cedfd76f9
User & Date: martin_vahi on 2016-09-05 00:34:48
Other Links: manifest | tags
Context
2016-10-29 18:19
repository URL specific download script check-in: c0fe686fe4 user: martin_vahi tags: trunk
2016-09-05 00:34
update to mmmv_Fossil_operator_t1.bash check-in: d6f691d449 user: martin_vahi tags: trunk
2016-08-20 07:49
Silktorrent propaganda leaflet check-in: 56f9b20300 user: martin_vahi tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Modified work_in_progress/mmmv_Fossil_operator_t1.bash from [31cc9fef70] to [ebb536fdad].

     2      2   # Initial author: Martin.Vahi@softf1.com
     3      3   # This file is in the public domain.
     4      4   #==========================================================================
     5      5   S_FP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
     6      6   S_FP_ORIG="`pwd`"
     7      7   S_TIMESTAMP="`date +%Y`_`date +%m`_`date +%d`_T_`date +%H`h_`date +%M`min_`date +%S`s"
     8      8   
     9         -fun_assert_exists_on_path_t1 () {
    10         -    local S_NAME_OF_THE_EXECUTABLE=$1 # first function argument
    11         -    local S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE 2>/dev/null\`"
            9  +
           10  +func_assert_exists_on_path_t2 () {
           11  +    local S_NAME_OF_THE_EXECUTABLE_1="$1" # first function argument
           12  +    local S_NAME_OF_THE_EXECUTABLE_2="$2" # optional argument
           13  +    local S_NAME_OF_THE_EXECUTABLE_3="$3" # optional argument
           14  +    local S_NAME_OF_THE_EXECUTABLE_4="$4" # optional argument
           15  +    #--------
           16  +    # Function calls like
           17  +    #
           18  +    #     func_assert_exists_on_path_t2  ""    ""  "ls"
           19  +    #     func_assert_exists_on_path_t2  "ls"  ""  "ps"
           20  +    #
           21  +    # are not allowed by the spec of this function, but it's OK to call
           22  +    #
           23  +    #     func_assert_exists_on_path_t2  "ls" "" 
           24  +    #     func_assert_exists_on_path_t2  "ls" "ps" ""
           25  +    #     func_assert_exists_on_path_t2  "ls" ""   "" ""
           26  +    #
           27  +    #
           28  +    local SB_THROW="f"
           29  +    if [ "$S_NAME_OF_THE_EXECUTABLE_1" == "" ] ; then
           30  +        SB_THROW="t"
           31  +    else
           32  +        if [ "$S_NAME_OF_THE_EXECUTABLE_2" == "" ] ; then
           33  +            if [ "$S_NAME_OF_THE_EXECUTABLE_3" != "" ] ; then
           34  +                SB_THROW="t"
           35  +            fi
           36  +            if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "" ] ; then
           37  +                SB_THROW="t"
           38  +            fi
           39  +        else
           40  +            if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
           41  +                if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "" ] ; then
           42  +                    SB_THROW="t"
           43  +                fi
           44  +            fi
           45  +        fi
           46  +    fi
           47  +    #----
           48  +    if [ "$SB_THROW" == "t" ] ; then
           49  +        echo ""
           50  +        echo "The Bash function "
           51  +        echo ""
           52  +        echo "    func_assert_exists_on_path_t2 "
           53  +        echo ""
           54  +        echo "is not designed to handle series of arguments, where "
           55  +        echo "empty strings preced non-empty strings."
           56  +        echo "GUID=='0541255e-4633-4cd9-b55c-f1e0305090e7'"
           57  +        echo ""
           58  +        #----
           59  +        cd $S_FP_ORIG
           60  +        exit 1 # exit with error
           61  +    fi
           62  +    if [ "$5" != "" ] ; then
           63  +        echo ""
           64  +        echo "This Bash function is designed to work with at most 4 input arguments"
           65  +        echo "GUID=='41001a45-42a8-4dd3-824c-f1e0305090e7'"
           66  +        echo ""
           67  +        #----
           68  +        cd $S_FP_ORIG
           69  +        exit 1 # exit with error
           70  +    fi
           71  +    #--------
           72  +    # Function calls like
           73  +    #
           74  +    #     func_assert_exists_on_path_t2 " "
           75  +    #     func_assert_exists_on_path_t2 "ls ps" # contains a space
           76  +    #
           77  +    # are not allowed.
           78  +    SB_THROW="f" 
           79  +    local S_TMP_0=""
           80  +    local S_TMP_1=""
           81  +    local S_TMP_2=""
           82  +    #----
           83  +    if [ "$SB_THROW" == "f" ] ; then
           84  +        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_1\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
           85  +        if [ "$S_NAME_OF_THE_EXECUTABLE_1" != "$S_TMP_0" ] ; then
           86  +            SB_THROW="t" 
           87  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_1"
           88  +            S_TMP_2="GUID=='2a1fd3d0-3841-4e87-854c-f1e0305090e7'"
           89  +        fi
           90  +    fi
           91  +    #----
           92  +    if [ "$SB_THROW" == "f" ] ; then
           93  +        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_2\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
           94  +        if [ "$S_NAME_OF_THE_EXECUTABLE_2" != "$S_TMP_0" ] ; then
           95  +            SB_THROW="t" 
           96  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_2"
           97  +            S_TMP_2="GUID=='d23cd2de-f38c-43f2-894c-f1e0305090e7'"
           98  +        fi
           99  +    fi
          100  +    #----
          101  +    if [ "$SB_THROW" == "f" ] ; then
          102  +        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_3\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          103  +        if [ "$S_NAME_OF_THE_EXECUTABLE_3" != "$S_TMP_0" ] ; then
          104  +            SB_THROW="t" 
          105  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_3"
          106  +            S_TMP_2="GUID=='7bf6f543-26c4-400e-a33c-f1e0305090e7'"
          107  +        fi
          108  +    fi
          109  +    #----
          110  +    if [ "$SB_THROW" == "f" ] ; then
          111  +        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_4\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          112  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "$S_TMP_0" ] ; then
          113  +            SB_THROW="t" 
          114  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_4"
          115  +            S_TMP_2="GUID=='a8746d54-43bc-4958-923c-f1e0305090e7'"
          116  +        fi
          117  +    fi
          118  +    #--------
          119  +    if [ "$SB_THROW" == "t" ] ; then
          120  +        echo ""
          121  +        echo "The Bash function "
          122  +        echo ""
          123  +        echo "    func_assert_exists_on_path_t2 "
          124  +        echo ""
          125  +        echo "is not designed to handle an argument value that contains "
          126  +        echo "spaces or tabulation characters."
          127  +        echo "The unaccepted value in parenthesis:($S_TMP_1)."
          128  +        echo "Branch $S_TMP_2."
          129  +        echo "GUID=='c3948131-401e-470a-a53c-f1e0305090e7'"
          130  +        echo ""
          131  +        #----
          132  +        cd $S_FP_ORIG
          133  +        exit 1 # exit with error
          134  +    fi
          135  +    SB_THROW="f" # Just a reset, should I forget to reset it later.
          136  +    #---------------
          137  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_1 2>/dev/null\`"
    12    138       local S_TMP_1=""
    13    139       local S_TMP_2="S_TMP_1=$S_TMP_0"
    14    140       eval ${S_TMP_2}
          141  +    #----
          142  +    if [ "$S_TMP_1" == "" ] ; then
          143  +        if [ "$S_NAME_OF_THE_EXECUTABLE_2" == "" ] ; then
          144  +        if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
          145  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
          146  +            echo ""
          147  +            echo "This bash script requires the \"$S_NAME_OF_THE_EXECUTABLE_1\" to be on the PATH."
          148  +            echo "GUID=='f284925c-b40f-4549-b22c-f1e0305090e7'"
          149  +            echo ""
          150  +            #----
          151  +            cd $S_FP_ORIG
          152  +            exit 1 # exit with error
          153  +        fi
          154  +        fi
          155  +        fi
          156  +    else
          157  +        return # at least one of the programs was available at the PATH
          158  +    fi
          159  +    #--------
          160  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_2 2>/dev/null\`"
          161  +    S_TMP_1=""
          162  +    S_TMP_2="S_TMP_1=$S_TMP_0"
          163  +    eval ${S_TMP_2}
          164  +    #----
          165  +    if [ "$S_TMP_1" == "" ] ; then
          166  +        if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
          167  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
          168  +            echo ""
          169  +            echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
          170  +            echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" is available on the PATH."
          171  +            echo "GUID=='7f92b447-d805-460e-912c-f1e0305090e7'"
          172  +            echo ""
          173  +            #----
          174  +            cd $S_FP_ORIG
          175  +            exit 1 # exit with error
          176  +        fi
          177  +        fi
          178  +    else
          179  +        return # at least one of the programs was available at the PATH
          180  +    fi
          181  +    #--------
          182  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_3 2>/dev/null\`"
          183  +    S_TMP_1=""
          184  +    S_TMP_2="S_TMP_1=$S_TMP_0"
          185  +    eval ${S_TMP_2}
          186  +    #----
          187  +    if [ "$S_TMP_1" == "" ] ; then
          188  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
          189  +            echo ""
          190  +            echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
          191  +            echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" or \"$S_NAME_OF_THE_EXECUTABLE_3\" "
          192  +            echo "is available on the PATH."
          193  +            echo "GUID=='39c63c1f-eec1-450d-b12c-f1e0305090e7'"
          194  +            echo ""
          195  +            #----
          196  +            cd $S_FP_ORIG
          197  +            exit 1 # exit with error
          198  +        fi
          199  +    else
          200  +        return # at least one of the programs was available at the PATH
          201  +    fi
          202  +    #--------
          203  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_4 2>/dev/null\`"
          204  +    S_TMP_1=""
          205  +    S_TMP_2="S_TMP_1=$S_TMP_0"
          206  +    eval ${S_TMP_2}
          207  +    #----
    15    208       if [ "$S_TMP_1" == "" ] ; then
    16    209           echo ""
    17         -        echo "This bash script requires the \"$S_NAME_OF_THE_EXECUTABLE\" to be on the PATH."
          210  +        echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
          211  +        echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" or \"$S_NAME_OF_THE_EXECUTABLE_3\" or "
          212  +        echo " \"$S_NAME_OF_THE_EXECUTABLE_4\" is available on the PATH."
          213  +        echo "GUID=='71c5f5de-2801-47fc-841c-f1e0305090e7'"
    18    214           echo ""
    19    215           #----
    20    216           cd $S_FP_ORIG
    21    217           exit 1 # exit with error
          218  +    else
          219  +        return # at least one of the programs was available at the PATH
          220  +    fi
          221  +    #--------
          222  +} # func_assert_exists_on_path_t2
          223  +
          224  +
          225  +func_assert_exists_on_path_t2 "cat"
          226  +func_assert_exists_on_path_t2 "file"                 # for checking MIME types
          227  +func_assert_exists_on_path_t2 "find"                 # for recursing
          228  +func_assert_exists_on_path_t2 "fossil"               # tested with v1.34
          229  +func_assert_exists_on_path_t2 "gawk"
          230  +func_assert_exists_on_path_t2 "grep"
          231  +func_assert_exists_on_path_t2 "nice"
          232  +func_assert_exists_on_path_t2 "ruby"                 # anything over/equal v.2.1 will probably do
          233  +func_assert_exists_on_path_t2 "shred" "gshred" "rm"  # for shredding, if possible
          234  +func_assert_exists_on_path_t2 "uname"                # to check the OS type
          235  +func_assert_exists_on_path_t2 "uuidgen" "uuid"       # for generating tmp file names
          236  +func_assert_exists_on_path_t2 "xargs"                # find . -name '*' | xargs blabla
          237  +func_assert_exists_on_path_t2 "wc"  
          238  +
          239  +
          240  +#--------------------------------------------------------------------------
          241  +
          242  +S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT=""
          243  +func_mmmv_operating_system_type_t1() {
          244  +    if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" == "" ]; then
          245  +        S_TMP_0="`uname -a | grep -E [Ll]inux`"
          246  +        if [ "$S_TMP_0" != "" ]; then
          247  +            S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="Linux"
          248  +        else
          249  +            S_TMP_0="`uname -a | grep BSD `"
          250  +            if [ "$S_TMP_0" != "" ]; then
          251  +                S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="BSD"
          252  +            else
          253  +                S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="undetermined"
          254  +            fi
          255  +        fi
          256  +    fi
          257  +} # func_mmmv_operating_system_type_t1
          258  +
          259  +func_mmmv_operating_system_type_t1
          260  +
          261  +if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" != "Linux" ]; then
          262  +    if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" != "BSD" ]; then
          263  +        echo ""
          264  +        echo "  The classical command line utilities at "
          265  +        echo "  different operating systems, for example, Linux and BSD,"
          266  +        echo "  differ. This script is designed to run only on "
          267  +        echo "  Linux and some BSD variants."
          268  +        echo "  If You are willing to risk that some of Your data "
          269  +        echo "  is deleted and/or Your operating system instance"
          270  +        echo "  becomes permanently flawed, to the point that "
          271  +        echo "  it will not even boot, then You may edit the Bash script that "
          272  +        echo "  displays this error message by modifying the test that "
          273  +        echo "  checks for the operating system type."
          274  +        echo ""
          275  +        echo "  If You do decide to edit this Bash script, then "
          276  +        echo "  a recommendation is to test Your modifications "
          277  +        echo "  within a virtual machine or, if virtual machines are not"
          278  +        echo "  an option, as some new operating system user that does not have "
          279  +        echo "  any access to the vital data/files."
          280  +        echo "  GUID=='52460304-7c62-4f4e-b51c-f1e0305090e7'"
          281  +        echo ""
          282  +        echo "  Aborting script without doing anything."
          283  +        echo ""
          284  +        exit 1 # exit with error
    22    285       fi
    23         -} # fun_assert_exists_on_path_t1
    24         -
    25         -fun_assert_exists_on_path_t1 "file"            # for checking MIME types
    26         -fun_assert_exists_on_path_t1 "find"            # for recursing
    27         -fun_assert_exists_on_path_t1 "fossil"          # tested with v1.34
    28         -fun_assert_exists_on_path_t1 "gawk"
    29         -fun_assert_exists_on_path_t1 "grep"
    30         -fun_assert_exists_on_path_t1 "cat"
    31         -fun_assert_exists_on_path_t1 "ruby"            # anything over/equal v.2.1 will probably do
    32         -fun_assert_exists_on_path_t1 "shred"           # for secure delete
    33         -fun_assert_exists_on_path_t1 "uname"           # to check the OS type
    34         -fun_assert_exists_on_path_t1 "uuidgen" "uuid"  # for generating tmp file names
    35         -fun_assert_exists_on_path_t1 "xargs"           # find . -name '*' | xargs blabla
    36         -fun_assert_exists_on_path_t1 "wc"  
    37         -
    38         -#--------------------------------------------------------------------------
    39         -S_TMP_0="`uname -a | grep -E [Ll]inux`"
    40         -if [ "$S_TMP_0" == "" ]; then
    41         -    echo ""
    42         -    echo "  The classical command line utilities at "
    43         -    echo "  different operating systems, for example, Linux and BSD,"
    44         -    echo "  differ. This script is designed to run only on Linux."
    45         -    echo "  If You are willing to risk that some of Your data "
    46         -    echo "  is deleted and/or Your operating system instance"
    47         -    echo "  becomes permanently flawed, to the point that "
    48         -    echo "  it will not even boot, then You may edit the Bash script that "
    49         -    echo "  displays this error message by modifying the test that "
    50         -    echo "  checks for the operating system type."
    51         -    echo ""
    52         -    echo "  If You do decide to edit this Bash script, then "
    53         -    echo "  a recommendation is to test Your modifications "
    54         -    echo "  within a virtual machine or, if virtual machines are not"
    55         -    echo "  an option, as some new operating system user that does not have "
    56         -    echo "  any access to the vital data/files."
    57         -    echo "  GUID=='61782b5c-e018-4acd-95d1-42e0800180e7'"
    58         -    echo ""
    59         -    echo "  Aborting script without doing anything."
    60         -    echo ""
    61         -    exit 1 # exit with error
    62    286   fi
    63    287   
    64    288   
    65    289   #--------------------------------------------------------------------------
    66    290   
    67    291   SB_EXISTS_ON_PATH_T1_RESULT="f"
    68    292   func_sb_exists_on_path_t1 () {
................................................................................
    79    303           echo ""
    80    304           echo "The Bash function "
    81    305           echo ""
    82    306           echo "    func_sb_exists_on_path_t1 "
    83    307           echo ""
    84    308           echo "is not designed to handle an argument that "
    85    309           echo "equals with an empty string."
    86         -        echo "GUID=='13ce522b-56b7-408c-94d1-42e0800180e7'"
          310  +        echo "GUID=='31ed2a21-41ac-4368-831c-f1e0305090e7'"
    87    311           echo ""
    88    312           #----
    89    313           cd $S_FP_ORIG
    90    314           exit 1 # exit with error
    91    315       fi
    92    316       local S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_1\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
    93    317       if [ "$S_NAME_OF_THE_EXECUTABLE_1" != "$S_TMP_0" ] ; then
................................................................................
    95    319           echo "The Bash function "
    96    320           echo ""
    97    321           echo "    func_sb_exists_on_path_t1 "
    98    322           echo ""
    99    323           echo "is not designed to handle an argument value that contains "
   100    324           echo "spaces or tabulation characters."
   101    325           echo "The received value in parenthesis:($S_NAME_OF_THE_EXECUTABLE_1)."
   102         -        echo "GUID=='2b1a2656-998c-41e0-b1c1-42e0800180e7'"
          326  +        echo "GUID=='40cb1b02-90f3-404e-8a0c-f1e0305090e7'"
   103    327           echo ""
   104    328           #----
   105    329           cd $S_FP_ORIG
   106    330           exit 1 # exit with error
   107    331       fi
   108    332       #--------
   109    333       S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_1 2>/dev/null\`"
................................................................................
   119    343   } # func_sb_exists_on_path_t1 
   120    344   
   121    345   
   122    346   #--------------------------------------------------------------------------
   123    347   
   124    348   S_FUNC_MMMV_GUID_T1_RESULT="not_yet_set"
   125    349   S_FUNC_MMMV_GUID_T1_MODE="" # optim. to skip repeating console tool selection
   126         -func_mmmv_GUID_t1() { 
          350  +func_mmmv_GUID_t1() {
   127    351       # Does not take any arguments.
   128    352       #--------
   129    353       #func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_GUID_t1" "$1"
   130    354       #--------------------
   131    355       local S_TMP_0="" # declaration
   132    356       local S_TMP_1="" # declaration
   133    357       # Mode selection:
................................................................................
   151    375           fi
   152    376           #--------
   153    377           if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "" ] ; then
   154    378               echo ""
   155    379               echo "All of the GUID generation implementations that this script " 
   156    380               echo "is capable of using (uuidgen, uuid) "
   157    381               echo "are missing from the PATH."
   158         -            echo "GUID=='5192d656-1e8f-4fd6-93c1-42e0800180e7'"
          382  +            echo "GUID=='3094c835-5f40-4884-b40c-f1e0305090e7'"
   159    383               echo ""
   160    384               #----
   161    385               cd $S_FP_ORIG
   162    386               exit 1 # exit with error
   163    387           fi
   164    388           #--------
   165    389           if [ "$?" != "0" ]; then
   166    390               echo ""
   167    391               echo "This script is flawed."
   168         -            echo "GUID=='25f74111-7f1d-4197-91c1-42e0800180e7'"
          392  +            echo "GUID=='817cc031-3315-4771-a3fb-f1e0305090e7'"
   169    393               echo ""
   170    394               #----
   171    395               cd $S_FP_ORIG
   172    396               exit 1 # exit with error
   173    397           fi
   174    398           #--------
   175    399       fi
................................................................................
   179    403       if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "uuidgen" ]; then
   180    404           S_TMP_0="`uuidgen`"
   181    405           if [ "$?" != "0" ]; then
   182    406               echo ""
   183    407               echo "The console application \"uuidgen\" "
   184    408               echo "exited with an error."
   185    409               echo ""
   186         -            echo "----console--outut--citation--start-----"
          410  +            echo "----console--output--citation--start-----"
   187    411               echo "`uuidgen`" # stdout and stderr
   188         -            echo "----console--outut--citation--end-------"
          412  +            echo "----console--output--citation--end-------"
   189    413               echo ""
   190         -            echo "GUID=='17c8dc2d-8a14-444f-84c1-42e0800180e7'"
          414  +            echo "GUID=='46b00d44-8784-489e-a5fb-f1e0305090e7'"
   191    415               echo ""
   192    416               #----
   193    417               cd $S_FP_ORIG
   194    418               exit 1 # exit with error
   195    419           fi
   196    420           #---- 
   197    421           S_FUNC_MMMV_GUID_T1_RESULT="$S_TMP_0"
................................................................................
   200    424       if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "uuid" ]; then
   201    425           S_TMP_0="`uuid`"
   202    426           if [ "$?" != "0" ]; then
   203    427               echo ""
   204    428               echo "The console application \"uuid\" "
   205    429               echo "exited with an error."
   206    430               echo ""
   207         -            echo "----console--outut--citation--start-----"
          431  +            echo "----console--output--citation--start-----"
   208    432               echo "`uuid`" # stdout and stderr
   209         -            echo "----console--outut--citation--end-------"
          433  +            echo "----console--output--citation--end-------"
   210    434               echo ""
   211         -            echo "GUID=='b9e270f1-5720-48d5-bcc1-42e0800180e7'"
          435  +            echo "GUID=='c3d42e43-1f05-4355-93fb-f1e0305090e7'"
   212    436               echo ""
   213    437               #----
   214    438               cd $S_FP_ORIG
   215    439               exit 1 # exit with error
   216    440           fi
   217    441           #---- 
   218    442           S_FUNC_MMMV_GUID_T1_RESULT="$S_TMP_0"
................................................................................
   230    454           echo ""
   231    455           echo "is something else. The flawed GUID candidate in parenthesis:"
   232    456           echo "($S_FUNC_MMMV_GUID_T1_RESULT)"
   233    457           echo ""
   234    458           echo "The lenght candidate of the flawed GUID candidate in parenthesis:"
   235    459           echo "($S_TMP_0)."
   236    460           echo ""
   237         -        echo "GUID=='cb099b28-40ac-4883-84c1-42e0800180e7'"
          461  +        echo "GUID=='4bba14f5-f666-40a4-9efb-f1e0305090e7'"
   238    462           echo ""
   239    463           #----
   240    464           cd $S_FP_ORIG
   241    465           exit 1 # exit with error
   242    466       fi
   243    467       #--------------------
   244    468   } # func_mmmv_GUID_t1
   245    469   
          470  +
          471  +#--------------------------------------------------------------------------
          472  +
          473  +S_FUNC_MMMV_SHRED_T1_MODE="" # optim. to skip repeating console tool selection
          474  +func_mmmv_shred_t1() {
          475  +    local S_FP_IN="$1" # path to the file or folder to be shredded
          476  +    # The next input parameter is a shoddy compromise,
          477  +    # for the case, where shred/gshred is not installed:
          478  +    local SB_OK_TO_USE_RM_IF_SHREDDING_APPS_NOT_AVAILABLE="$2"  # domain: {"","f","t"}
          479  +    #--------------------
          480  +    if [ "$SB_OK_TO_USE_RM_IF_SHREDDING_APPS_NOT_AVAILABLE" != "" ] ; then
          481  +        if [ "$SB_OK_TO_USE_RM_IF_SHREDDING_APPS_NOT_AVAILABLE" != "t" ] ; then
          482  +            if [ "$SB_OK_TO_USE_RM_IF_SHREDDING_APPS_NOT_AVAILABLE" != "f" ] ; then
          483  +                echo ""
          484  +                echo "The second parameter of this function, the "
          485  +                echo ""
          486  +                echo "    SB_OK_TO_USE_RM_IF_SHREDDING_APPS_NOT_AVAILABLE(==$SB_OK_TO_USE_RM_IF_SHREDDING_APPS_NOT_AVAILABLE)"
          487  +                echo ""
          488  +                echo "is optional, but its range is {\"\",\"f\",\"t\"},"
          489  +                echo "without the quotation marks."
          490  +                echo "GUID=='502df336-4c86-4286-83fb-f1e0305090e7'"
          491  +                echo ""
          492  +                #----
          493  +                cd $S_FP_ORIG
          494  +                exit 1 # exit with error
          495  +            fi
          496  +        fi
          497  +    else # $SB_OK_TO_USE_RM_IF_SHREDDING_APPS_NOT_AVAILABLE == ""
          498  +        SB_OK_TO_USE_RM_IF_SHREDDING_APPS_NOT_AVAILABLE="f"
          499  +    fi
          500  +    #--------------------
          501  +    # Declarations:
          502  +    local SB_THROW=""
          503  +    local SB_USE_RUBY=""
          504  +    local S_CMD=""
          505  +    local S_GUID=""
          506  +    local S_TMP_0=""
          507  +    local S_TMP_1=""
          508  +    local S_TMP_2=""
          509  +    local SI_0="-9999"
          510  +    local SI_1="-9999"
          511  +    local S_SHREDDER_APPLICATION_NAME=""
          512  +    local S_FP_PWD_BEFORE_SHREDDING=""
          513  +    #--------------------
          514  +    # Mode selection:
          515  +    if [ "$S_FUNC_MMMV_SHRED_T1_MODE" == "" ] ; then
          516  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
          517  +        #----
          518  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          519  +            S_TMP_0="shred" # Linux version
          520  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
          521  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          522  +                 S_FUNC_MMMV_SHRED_T1_MODE="$S_TMP_0"
          523  +            fi
          524  +        fi
          525  +        #----
          526  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          527  +            S_TMP_0="gshred" # BSD version
          528  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
          529  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          530  +                 S_FUNC_MMMV_SHRED_T1_MODE="$S_TMP_0"
          531  +            fi
          532  +        fi
          533  +        #----
          534  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          535  +            if [ "$SB_OK_TO_USE_RM_IF_SHREDDING_APPS_NOT_AVAILABLE" == "t" ] ; then
          536  +                S_TMP_0="rm" # a shoddy compromise version for exeptional cases
          537  +                func_sb_exists_on_path_t1 "$S_TMP_0" 
          538  +                if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          539  +                    func_mmmv_operating_system_type_t1
          540  +                    if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" != "BSD" ]; then
          541  +                         S_FUNC_MMMV_SHRED_T1_MODE="rm_BSD"
          542  +                    else # Linux and all the rest
          543  +                         S_FUNC_MMMV_SHRED_T1_MODE="rm_plain"
          544  +                    fi
          545  +                else
          546  +                    echo ""
          547  +                    echo "Something is wrong at the operating system "
          548  +                    echo "environment setup. All UNIX-like operating systems "
          549  +                    echo "and their emulators "
          550  +                    echo "are expected to have the \"rm\" command."
          551  +                    echo ""
          552  +                    echo "    \$(which rm)==\"`which rm`\""
          553  +                    echo ""
          554  +                    echo "    PATH=$PATH" # will be a huge string
          555  +                    echo ""
          556  +                    echo "GUID=='a6e67041-a70f-4e87-92fb-f1e0305090e7'"
          557  +                    echo ""
          558  +                    #----
          559  +                    cd $S_FP_ORIG
          560  +                    exit 1 # exit with error
          561  +                fi
          562  +            fi
          563  +        fi
          564  +        #--------
          565  +        if [ "$S_FUNC_MMMV_SHRED_T1_MODE" == "" ] ; then
          566  +            echo ""
          567  +            echo "All of the file shredding implementations that this script " 
          568  +            echo "is capable of using (shred, gshred) "
          569  +            echo "are missing from the PATH."
          570  +            echo "GUID=='2db9ac59-a8f0-4852-a1eb-f1e0305090e7'"
          571  +            echo ""
          572  +            #----
          573  +            cd $S_FP_ORIG
          574  +            exit 1 # exit with error
          575  +        fi
          576  +        #--------
          577  +        if [ "$?" != "0" ]; then
          578  +            echo ""
          579  +            echo "This script is flawed."
          580  +            echo "GUID=='4a9e0e43-a179-434b-81eb-f1e0305090e7'"
          581  +            echo ""
          582  +            #----
          583  +            cd $S_FP_ORIG
          584  +            exit 1 # exit with error
          585  +        fi
          586  +        #--------
          587  +    fi
          588  +    #--------------------
          589  +    S_TMP_0=$(echo $S_FP_IN | gawk '{gsub(/^[\/]/,""); printf "%s",$1 }')
          590  +    if [ "$S_TMP_0" == "$S_FP_IN" ]; then
          591  +        echo "" 
          592  +        echo "The path is expected to be an absolute path, "
          593  +        echo "but currently it is not."
          594  +        echo "    S_FP_IN==$S_FP_IN"
          595  +        echo "GUID=='b72d3528-b829-43dd-b4eb-f1e0305090e7'"
          596  +        echo ""
          597  +        #----
          598  +        cd $S_FP_ORIG
          599  +        exit 1 # exit with an error
          600  +    fi
          601  +    #--------
          602  +    if [ -h $S_FP_IN ]; then 
          603  +        # The control flow is in here regardless of
          604  +        # whether the symbolic link is broken or not.
          605  +        # If the path is to a non-existing file/link/folder,
          606  +        # then the control flow will not enter this branch.
          607  +        echo ""
          608  +        echo "The "
          609  +        echo "    S_FP_IN=$S_FP_IN"
          610  +        echo "is a symbolic link, but it is expected to "
          611  +        echo "be a file or a folder."
          612  +        echo "GUID=='2ff01c25-3734-48c8-a9eb-f1e0305090e7'"
          613  +        echo ""
          614  +        #----
          615  +        cd $S_FP_ORIG
          616  +        exit 1 # exit with error
          617  +    fi
          618  +    if [ ! -e $S_FP_IN ]; then
          619  +        echo ""
          620  +        echo "The "
          621  +        echo "    S_FP_IN=$S_FP_IN"
          622  +        echo "does not exist."
          623  +        echo "GUID=='2b88f713-2945-4752-a4eb-f1e0305090e7'"
          624  +        echo ""
          625  +        #----
          626  +        cd $S_FP_ORIG
          627  +        exit 1 # exit with error
          628  +    fi
          629  +    #--------
          630  +    if [ -d $S_FP_IN ]; then
          631  +        #--------start--of--sub-path--check----
          632  +        # If the $S_FP_IN is a folder, then the `pwd` 
          633  +        # should not be a sub-path or a path of the 
          634  +        # folder that is being deleted.
          635  +        S_TMP_0="`cd $S_FP_IN;pwd`/"  
          636  +        S_TMP_1="`pwd`/"
          637  +        #----
          638  +        if [ "$S_TMP_0" == "$S_TMP_1" ]; then
          639  +            if [ ! -d $S_FP_IN ]; then
          640  +                echo ""
          641  +                echo "This Bash script is flawed. "
          642  +                echo "    S_FP_IN=$S_FP_IN"
          643  +                echo "GUID=='5b46db54-09a9-41ab-b5eb-f1e0305090e7'"
          644  +                echo ""
          645  +                #----
          646  +                cd $S_FP_ORIG
          647  +                exit 1
          648  +            fi
          649  +            #----
          650  +            echo ""
          651  +            echo "The working directory, "
          652  +            echo ""
          653  +            echo "    PWD=$PWD"
          654  +            echo ""
          655  +            echo "equals with the folder that is being deleted."
          656  +            echo ""
          657  +            echo "    S_TMP_0=$S_TMP_0"
          658  +            echo ""
          659  +            echo "    S_FP_IN=$S_FP_IN"
          660  +            echo ""
          661  +            echo "GUID=='167f9421-0412-433c-91db-f1e0305090e7'"
          662  +            echo ""
          663  +            #----
          664  +            cd $S_FP_ORIG
          665  +            exit 1 # exit with error
          666  +        fi
          667  +        #----
          668  +        # If the normalized $S_FP_IN is a folder and 
          669  +        # the "`pwd`/" is shorter than the normalized $S_FP_IN, then,
          670  +        # with the exceptions of some symbolic links, 
          671  +        # the "`pwd`/" can not be equal to the normalized $S_FP_IN, 
          672  +        # nor can the "`pwd`/" be a folder that is a sub-folder 
          673  +        # of the $S_FP_IN.
          674  +        # 
          675  +        # The paht lenght code is:
          676  +        # 
          677  +        #     SI_0="` echo \"$S_TMP_0\" | gawk '{i=length;printf "%s", i }' `" # S_FP_IN
          678  +        #     SI_1="` echo \"$S_TMP_1\" | gawk '{i=length;printf "%s", i }' `" # pwd
          679  +        #     if [ "$SI_0" -lt "$SI_1" ]; then  # $SI_0 < $SI_1
          680  +        #        #echo "$SI_0 < $SI_1"
          681  +        #        #
          682  +        #        # In here the length of the normalized form of the $S_FP_IN
          683  +        #        # is shorter than the "`pwd`/" and therefore the working directory
          684  +        #        # has a greater probability to be at a sub-path of the $S_FP_IN.
          685  +        #        
          686  +        #        <
          687  +        #         A lot of Ruby code, because 
          688  +        #         the gawk code will have trouble with folders that 
          689  +        #         contain spaces and other special characters
          690  +        #         >
          691  +        #    fi
          692  +        #
          693  +        # but unfortunately the Ruby code that uses 
          694  +        # temporary files and the String.index would be 
          695  +        # unstable due to the 
          696  +        #
          697  +        #     https://bugs.ruby-lang.org/issues/12710
          698  +        #     https://archive.is/AJpgL
          699  +        # 
          700  +        # Add to that the fact that this Bash function
          701  +        # would be much more appealing, if it did not launch
          702  +        # any 40BiB sized interpreters like the Ruby interpreter (in 2016)
          703  +        # and the temptation to just skip testing, whether the 
          704  +        # working directory (`pwd`) resides at a directory that
          705  +        # is a sub-path of the $S_FP_IN, grows even higher.
          706  +        # So, for the time being that check is omitted from here. 
          707  +        #
          708  +        # TODO: If the year is at least 2020, then try to find out, 
          709  +        #       whether there's some elegant way to implement that check.
          710  +        #
          711  +        # A code fragment for later consideration:
          712  +        #     S_TMP_2="`echo \"$S_TMP_0\" | gawk '{gsub(/\s/,\"NotASpace\");printf \"%s\", \$1 }' `"
          713  +        #     if [ "$S_TMP_2" != "$S_TMP_0" ]; then
          714  +        #         # S_TMP_0 contains strings
          715  +        #         SB_USE_RUBY="t"
          716  +        #     fi
          717  +        #--------end--of--sub-path--check----
          718  +    fi
          719  +    #--------------------
          720  +    S_FP_PWD_BEFORE_SHREDDING="`pwd`"
          721  +    S_CMD="" # to be sure
          722  +    #--------------------
          723  +    S_TMP_0="cd $S_FP_IN ; nice -n10 find . -name '*' | nice -n10 xargs "
          724  +    # The space after the "cd $S_FP_IN" and before the ";" is compulsory.
          725  +    #----
          726  +    # The "2>/dev/null" after the shredding/deletion command
          727  +    # is to hide the file permissions related error messages.
          728  +    # The failure is detected by studying file existence.
          729  +    #--------------------
          730  +    if [ "$S_FUNC_MMMV_SHRED_T1_MODE" == "shred" ]; then
          731  +        S_SHREDDER_APPLICATION_NAME="shred"
          732  +        if [ -d $S_FP_IN ]; then
          733  +            S_CMD="$S_TMP_0 \
          734  +                   $S_SHREDDER_APPLICATION_NAME -f --remove 2>/dev/null "
          735  +        else
          736  +            S_CMD="nice -n10 $S_SHREDDER_APPLICATION_NAME -f --remove $S_FP_IN 2>/dev/null "
          737  +        fi
          738  +    fi
          739  +    #----
          740  +    if [ "$S_FUNC_MMMV_SHRED_T1_MODE" == "gshred" ]; then
          741  +        S_SHREDDER_APPLICATION_NAME="gshred"
          742  +        if [ -d $S_FP_IN ]; then
          743  +            S_CMD="$S_TMP_0 \
          744  +                   $S_SHREDDER_APPLICATION_NAME --force --iterations=2 --remove -z 2>/dev/null "
          745  +        else
          746  +            S_CMD="nice -n10 \
          747  +                   $S_SHREDDER_APPLICATION_NAME --force --iterations=2 --remove -z $S_FP_IN 2>/dev/null "
          748  +        fi
          749  +    fi
          750  +    #----
          751  +    # The "rm" on Linux and BSD differ, 
          752  +    # a bit like the "ps" # on Linux and BSD differ.
          753  +    # The "rm -f -P foo" overwrites the file with NON-random 
          754  +    # values before deleting.
          755  +    # The "rm -f    foo" works, whenever the "rm" is called by the file owner.
          756  +    # The "rm -f -P foo" requires write permissions even, 
          757  +    # if the "rm" is called by the file owner.
          758  +    if [ "$S_FUNC_MMMV_SHRED_T1_MODE" == "rm_BSD" ]; then
          759  +        S_SHREDDER_APPLICATION_NAME="rm"
          760  +        if [ -d $S_FP_IN ]; then
          761  +            S_CMD="$S_TMP_0 \
          762  +            $S_SHREDDER_APPLICATION_NAME -f -P $S_FP_IN 2>/dev/null "
          763  +        else
          764  +            S_CMD="nice -n10 $S_SHREDDER_APPLICATION_NAME -f -P $S_FP_IN 2>/dev/null "
          765  +        fi
          766  +    fi
          767  +    if [ "$S_FUNC_MMMV_SHRED_T1_MODE" == "rm_plain" ]; then
          768  +        # The "rm -f    foo" seems to be universally available
          769  +        # at all UNIX-like environments.
          770  +        S_SHREDDER_APPLICATION_NAME="rm"
          771  +        if [ -d $S_FP_IN ]; then
          772  +            S_CMD="$S_TMP_0 \
          773  +            $S_SHREDDER_APPLICATION_NAME -f $S_FP_IN 2>/dev/null "
          774  +        else
          775  +            S_CMD="nice -n10 $S_SHREDDER_APPLICATION_NAME -f $S_FP_IN 2>/dev/null "
          776  +        fi
          777  +    fi
          778  +    #--------------------
          779  +    eval "$S_CMD" # the "eval" is required due to the command "find"
          780  +    cd $S_FP_PWD_BEFORE_SHREDDING # required if the $S_FP_IN  was a folder
          781  +    if [ -e $S_FP_IN ]; then 
          782  +        # If the control flow is here, then the $S_FP_IN was 
          783  +        # a folder or the deletion failed or both.
          784  +        chmod -f -R 0700 $S_FP_IN  # chmod 0777 would introduce s security flaw
          785  +        eval "$S_CMD" # the "eval" is required due to the command "find"
          786  +        cd $S_FP_PWD_BEFORE_SHREDDING
          787  +        #----
          788  +        SB_THROW="f"
          789  +        if [ -d $S_FP_IN ]; then 
          790  +            S_TMP_0="`cd $S_FP_IN; pwd`" # "./home///foo" -> "/home/foo"
          791  +            # Checks are intentionally missing to 
          792  +            # allow this Bash function to be universal, without exceptions.
          793  +            #----
          794  +            cd $S_TMP_0
          795  +            S_TMP_1="`find . -name '*' | \
          796  +                      xargs file --mime-type | \
          797  +                      grep -v directory | grep -v folder `"
          798  +                    # The   file --mime-type foo
          799  +                    # works on both, Linux and BSD. 
          800  +            cd $S_FP_PWD_BEFORE_SHREDDING
          801  +            #----
          802  +            if [ "$S_TMP_1" == "" ]; then
          803  +                rm -fr $S_TMP_0
          804  +            else
          805  +                SB_THROW="t"
          806  +                S_GUID="'23c2b1e5-3972-4dc6-a2db-f1e0305090e7'"
          807  +            fi
          808  +        fi
          809  +        #----
          810  +        if [ "$SB_THROW" == "f" ]; then # to avoid overwriting the S_GUID
          811  +            if [ -e $S_FP_IN ]; then
          812  +                SB_THROW="t"
          813  +                S_GUID="'ca0b9b36-4ea9-4be6-92db-f1e0305090e7'"
          814  +            fi 
          815  +        fi 
          816  +        if [ "$SB_THROW" == "t" ]; then
          817  +            echo ""
          818  +            echo "The deletion failed even after the "
          819  +            echo ""
          820  +            echo "    chmod -f -R 0700 $S_FP_IN "
          821  +            echo ""
          822  +            echo "The "
          823  +            echo ""
          824  +            echo "    chmod 0777 "
          825  +            echo ""
          826  +            echo "is not done automatically in this "
          827  +            echo "Bash function, because "
          828  +            echo "it might introduce a security flaw."
          829  +            echo ""
          830  +            echo "    S_FUNC_MMMV_SHRED_T1_MODE=$S_FUNC_MMMV_SHRED_T1_MODE"
          831  +            echo ""
          832  +            echo "    S_CMD=$S_CMD"
          833  +            echo ""
          834  +            echo "GUID==$S_GUID"
          835  +            echo "GUID=='73d84042-9e60-4316-b3db-f1e0305090e7'"
          836  +            echo ""
          837  +            #----
          838  +            cd $S_FP_ORIG
          839  +            exit 1 # exit with error
          840  +        fi
          841  +    fi
          842  +    S_GUID="'693c9923-46d0-4603-92db-f1e0305090e7'" #counters S_GUID related flaws
          843  +    #--------------------
          844  +    if [ -e $S_FP_IN ]; then
          845  +        echo ""
          846  +        echo "The deletion of the "
          847  +        echo "    S_FP_IN=$S_FP_IN"
          848  +        echo "failed or the file or folder was re-created by "
          849  +        echo "some other process before this file existance check."
          850  +        echo "GUID=='4c690312-7d59-43db-95cb-f1e0305090e7'"
          851  +        echo ""
          852  +        #----
          853  +        cd $S_FP_ORIG
          854  +        exit 1 # exit with error
          855  +    fi
          856  +    #--------------------
          857  +    cd $S_FP_PWD_BEFORE_SHREDDING
          858  +} # func_mmmv_shred_t1
          859  +
   246    860   
   247    861   #--------------------------------------------------------------------------
   248    862   S_TMP_0=""
   249    863   S_ACTIVITY_OF_THIS_SCRIPT=$1
   250    864   S_URL_REMOTE_REPOSITORY=""
   251    865   SB_EXIT_WITH_ERROR="f"
   252    866   
................................................................................
   267    881           echo "Aborting script without doing anything."
   268    882           echo ""
   269    883       fi 
   270    884       #----
   271    885       cd $S_FP_ORIG
   272    886       exit 0
   273    887   } # fun_exit_without_any_errors_t1
          888  +
          889  +#--------------------------------------------------------------------------
          890  +
          891  +SB_FUNC_MMMV_ASSERT_FILE_PATHS_DIFFER_T1_ASSERTION_FAILED="f"
          892  +func_mmmv_assert_file_paths_differ_t1(){
          893  +    local S_FP_0="$1"
          894  +    local S_FP_1="$2"
          895  +    local S_GUID="$3"
          896  +    local SB_DO_NOT_TRHOW_ON_ASSERTION_FAILURE="$4" # domain: {"","f","t"}
          897  +    #--------
          898  +    if [ "$SB_DO_NOT_TRHOW_ON_ASSERTION_FAILURE" != "" ] ; then
          899  +        if [ "$SB_DO_NOT_TRHOW_ON_ASSERTION_FAILURE" != "t" ] ; then
          900  +            if [ "$SB_DO_NOT_TRHOW_ON_ASSERTION_FAILURE" != "f" ] ; then
          901  +                echo ""
          902  +                echo "The fourth parameter of this function, the "
          903  +                echo ""
          904  +                echo "    SB_DO_NOT_TRHOW_ON_ASSERTION_FAILURE(==$SB_DO_NOT_TRHOW_ON_ASSERTION_FAILURE)"
          905  +                echo ""
          906  +                echo "is optional, but its range is {\"\",\"f\",\"t\"},"
          907  +                echo "without the quotation marks."
          908  +                echo "GUID=='55200d1b-73f9-46a3-82cb-f1e0305090e7'"
          909  +                echo ""
          910  +                #----
          911  +                cd $S_FP_ORIG
          912  +                exit 1 # exit with error
          913  +            fi
          914  +        fi
          915  +    else # $SB_DO_NOT_TRHOW_ON_ASSERTION_FAILURE == ""
          916  +        SB_DO_NOT_TRHOW_ON_ASSERTION_FAILURE="f"
          917  +    fi
          918  +    SB_FUNC_MMMV_ASSERT_FILE_PATHS_DIFFER_T1_ASSERTION_FAILED="f" # global
          919  +    #--------
          920  +    # The block of if-else statements for comparing the 2 paths
          921  +    # is so error prone to write that this function is written 
          922  +    # according to a schematic that resides at:
          923  +    # http://longterm.softf1.com/documentation_fragments/2016_09_03_comparison_of_file_paths_t1/
          924  +    # https://archive.is/R4yw9
          925  +    #--------
          926  +    # Declarations:
          927  +    local S_GUID_CRAWL="S_GUID_CRAWL not set" # tree crawling at the schematic
          928  +    local S_GUID_CMP="S_GUID_CMP not set"     # comparison at tree leaf
          929  +                                              # Some leaves are equivalent.
          930  +    local S_COMPARISON_MODE="" 
          931  +    local SB_THROW="f" 
          932  +    local SB_ASSERTION_FAILED="f" 
          933  +    local SB_STR0="f" # whether S_FP_0 is compared purely as a string
          934  +    local SB_STR1="f" # whether S_FP_1 is compared purely as a string
          935  +    local S_FP_0_STR="$S_FP_0" 
          936  +    local S_FP_1_STR="$S_FP_1"
          937  +    local S_FP_X="" # a temporary variable for holding path value
          938  +    local S_RUBY_SRC_0=""
          939  +    #--------
          940  +    if [ "$S_FP_0" == "$S_FP_1" ]; then 
          941  +        # Covers also the case, where both are existing 
          942  +        # folders, but the paths to them contains "../".
          943  +        # By making the string comparison to be the first thing tried 
          944  +        # a few file system accesses might be saved.
          945  +        SB_ASSERTION_FAILED="t"
          946  +        S_GUID_CRAWL="644d292d-c01e-47d0-855c-f1e0305090e7"
          947  +        S_GUID_CMP="57bc9b05-da56-4eff-954c-f1e0305090e7"
          948  +    else # the rest of the 3 comparison modes
          949  +        #--------
          950  +        if [ -e $S_FP_0 ]; then 
          951  +            if [ -d $S_FP_0 ]; then 
          952  +                if [ -e $S_FP_1 ]; then 
          953  +                    if [ -d $S_FP_1 ]; then 
          954  +                        S_COMPARISON_MODE="cmode_cd0_cd1"
          955  +                    else 
          956  +                        S_COMPARISON_MODE="cmode_cd0_str1"
          957  +                        SB_STR1="t"
          958  +                    fi 
          959  +                else 
          960  +                    S_COMPARISON_MODE="cmode_cd0_str1"
          961  +                    SB_STR1="t"
          962  +                fi
          963  +            else 
          964  +                if [ -e $S_FP_1 ]; then 
          965  +                    if [ -d $S_FP_1 ]; then 
          966  +                        S_COMPARISON_MODE="cmode_str0_cd1"
          967  +                        SB_STR0="t"
          968  +                    else 
          969  +                        S_COMPARISON_MODE="cmode_str0_str1"
          970  +                        SB_STR0="t"
          971  +                        SB_STR1="t"
          972  +                    fi 
          973  +                else 
          974  +                    S_COMPARISON_MODE="cmode_str0_str1"
          975  +                    SB_STR0="t"
          976  +                    SB_STR1="t"
          977  +                fi
          978  +            fi
          979  +        else # $S_FP_0 is missing or it is a broken symbolic link
          980  +            if [ -e $S_FP_1 ]; then 
          981  +                if [ -d $S_FP_1 ]; then 
          982  +                    S_COMPARISON_MODE="cmode_str0_cd1"
          983  +                    SB_STR0="t"
          984  +                else 
          985  +                    S_COMPARISON_MODE="cmode_str0_str1"
          986  +                    SB_STR0="t"
          987  +                    SB_STR1="t"
          988  +                fi
          989  +            else 
          990  +                S_COMPARISON_MODE="cmode_str0_str1"
          991  +                SB_STR0="t"
          992  +                SB_STR1="t"
          993  +            fi
          994  +        fi
          995  +        #----------------        
          996  +        # The "cmode_str0_str1" was tried 
          997  +        # at the first if-clause of the block, but 
          998  +        # that does not catch equivalent cases like 
          999  +        #
         1000  +        #     S_FP_0="`pwd`/././////a_nonexisting_file_or_folder"
         1001  +        #     S_FP_1="`pwd`/a_nonexisting_file_or_folder"
         1002  +        #
         1003  +        #     S_FP_0="./a_nonexisting_file_or_folder"
         1004  +        #     S_FP_1="././././././a_nonexisting_file_or_folder"
         1005  +        #
         1006  +        #     S_FP_0="/a_nonexisting_file_or_folder"
         1007  +        #     S_FP_1="/////a_nonexisting_file_or_folder"
         1008  +        #
         1009  +        #     S_FP_0="/a_nonexisting_file_or_folder"
         1010  +        #     S_FP_1="/..///../a_nonexisting_file_or_folder"
         1011  +        #
         1012  +        # String normalization is required whenever at least
         1013  +        # one of the paths is used at comparison 
         1014  +        # purely as a string.
         1015  +        #
         1016  +        #----start-of-Ruby-script-header--for-copy/pasting----
         1017  +        #    #!/usr/bin/env ruby
         1018  +        #    
         1019  +        #    s_fp_0="./a_nonexisting_file_or_folder"
         1020  +        #    s_fp_1="././..//../.././a_nonexisting_file_or_folder"
         1021  +        #    
         1022  +        #    # The path "/../foo" is equivalent to "/foo".
         1023  +        #    s_fp_2="/././..//../.././a_nonexisting_file_or_folder"
         1024  +        #    
         1025  +        #    # This script does not cover the case, 
         1026  +        #    # where "./aa/../bb" is equivalent to "./bb"
         1027  +        #----end---of-Ruby-script-header-for-copy/pasting----
         1028  +        S_RUBY_SRC_0="\
         1029  +            s_0='';\
         1030  +            s_1=ARGV[0].to_s;\
         1031  +            rgx_0=/[\\/][.][\\/]/;\
         1032  +            rgx_1=/^[.][\\/]/;\
         1033  +            rgx_2=/^[\\/][.][.][\\/]/;\
         1034  +            i_4safety=0;\
         1035  +            while s_0!=s_1 do ;\
         1036  +               s_0=s_1;\
         1037  +               s_1=s_0.gsub(rgx_0,'/');\
         1038  +               i_4safety=i_4safety+1;\
         1039  +               if 10000<i_4safety then ;\
         1040  +                  raise(Exception.new('boo'));\
         1041  +               end;\
         1042  +            end ;\
         1043  +            s_0=s_1;\
         1044  +            s_1=s_0.gsub(rgx_1,'');\
         1045  +            s_0=s_1;\
         1046  +            s_1=s_0.gsub(/[\\/]+/,'/');\
         1047  +            ;\
         1048  +            ;\
         1049  +            i_4safety=0;\
         1050  +            while s_0!=s_1 do ;\
         1051  +               s_0=s_1;\
         1052  +               s_1=s_0.gsub(rgx_2,'/');\
         1053  +               i_4safety=i_4safety+1;\
         1054  +               if 10000<i_4safety then ;\
         1055  +                  raise(Exception.new('10b7aae4-1940-4361-a4cb-f1e0305090e7'));\
         1056  +               end;\
         1057  +            end ;\
         1058  +            s_0=s_1;\
         1059  +            s_1=s_0.gsub(rgx_1,'');\
         1060  +            s_0=s_1;\
         1061  +            s_1=s_0.gsub(/[\\/]+/,'/');\
         1062  +            ;\
         1063  +            print s_1;\
         1064  +            "
         1065  +        #----
         1066  +        if [ "$SB_STR0" == "t" ]; then 
         1067  +            S_FP_0_STR="`ruby -e \"$S_RUBY_SRC_0\" $S_FP_0`"
         1068  +        fi
         1069  +        if [ "$SB_STR1" == "t" ]; then 
         1070  +            S_FP_1_STR="`ruby -e \"$S_RUBY_SRC_0\" $S_FP_1`"
         1071  +        fi
         1072  +        #----------------        
         1073  +        if [ "$S_COMPARISON_MODE" == "cmode_cd0_str1" ]; then 
         1074  +            # 2 cases at the schematic
         1075  +            S_FP_X="`cd $S_FP_0;pwd`"
         1076  +            if [ "$S_FP_X" == "$S_FP_1_STR" ]; then 
         1077  +                SB_ASSERTION_FAILED="t"
         1078  +                S_GUID_CMP="3a6056a5-c267-4111-b24c-f1e0305090e7"
         1079  +            fi
         1080  +            if [ "$SB_ASSERTION_FAILED" != "t" ]; then 
         1081  +                if [ "$S_FP_X" == "$S_FP_1" ]; then # just in case
         1082  +                    SB_ASSERTION_FAILED="t"
         1083  +                    S_GUID_CMP="57a656e5-aa92-40a8-a53c-f1e0305090e7"
         1084  +                fi
         1085  +            fi
         1086  +        else
         1087  +            if [ "$S_COMPARISON_MODE" == "cmode_str0_cd1" ]; then 
         1088  +                # 2 cases at the schematic
         1089  +                S_FP_X="`cd $S_FP_1;pwd`"
         1090  +                if [ "$S_FP_0_STR" == "$S_FP_X" ]; then 
         1091  +                    SB_ASSERTION_FAILED="t"
         1092  +                    S_GUID_CMP="2bc33092-26d1-4787-953c-f1e0305090e7"
         1093  +                fi
         1094  +                if [ "$SB_ASSERTION_FAILED" != "t" ]; then 
         1095  +                    if [ "$S_FP_0" == "$S_FP_X" ]; then # just in case
         1096  +                        SB_ASSERTION_FAILED="t"
         1097  +                        S_GUID_CMP="05494129-51a8-4d7d-923c-f1e0305090e7"
         1098  +                    fi
         1099  +                fi
         1100  +            else
         1101  +                if [ "$S_COMPARISON_MODE" == "cmode_cd0_cd1" ]; then 
         1102  +                    if [ "`cd $S_FP_0;pwd`" == "`cd $S_FP_1;pwd`" ]; then 
         1103  +                        SB_ASSERTION_FAILED="t"
         1104  +                        S_GUID_CMP="37d42234-a57e-4d78-b52c-f1e0305090e7"
         1105  +                    fi
         1106  +                else 
         1107  +                    if [ "$S_COMPARISON_MODE" == "cmode_str0_str1" ]; then 
         1108  +                        if [ "$S_FP_0_STR" == "$S_FP_1_STR" ]; then 
         1109  +                            SB_ASSERTION_FAILED="t"
         1110  +                            S_GUID_CMP="b0eb5d1d-9b86-4d66-812c-f1e0305090e7"
         1111  +                        fi
         1112  +                        # The if [ "$S_FP_0" == "$S_FP_1" ] ...
         1113  +                        # has already been tried at the very start 
         1114  +                        # of the huge if-block.
         1115  +                    else
         1116  +                        echo ""
         1117  +                        echo "This script is flawed."
         1118  +                        echo ""
         1119  +                        echo "    S_FP_0=$S_FP_0"
         1120  +                        echo "    S_FP_1=$S_FP_1"
         1121  +                        echo "    S_GUID_CRAWL=$S_GUID_CRAWL"
         1122  +                        echo "    S_GUID_CMP=$S_GUID_CMP"
         1123  +                        echo "    S_COMPARISON_MODE=$S_COMPARISON_MODE"
         1124  +                        echo ""
         1125  +                        echo "GUID=='14286012-4658-42f9-94cb-f1e0305090e7'"
         1126  +                        echo ""
         1127  +                        #----
         1128  +                        cd $S_FP_ORIG
         1129  +                        exit 1 # exit with error
         1130  +                    fi
         1131  +                fi
         1132  +            fi
         1133  +        fi
         1134  +    fi
         1135  +    #--------
         1136  +    SB_FUNC_MMMV_ASSERT_FILE_PATHS_DIFFER_T1_ASSERTION_FAILED="$SB_ASSERTION_FAILED" # global
         1137  +    if [ "$SB_ASSERTION_FAILED" == "t" ]; then 
         1138  +        if [ "$SB_DO_NOT_TRHOW_ON_ASSERTION_FAILURE" != "t" ]; then
         1139  +            echo ""
         1140  +            echo "The file paths "
         1141  +            echo ""
         1142  +            echo "    S_FP_0=$S_FP_0"
         1143  +            echo ""
         1144  +            echo "    S_FP_1=$S_FP_1"
         1145  +            echo ""
         1146  +            echo "are required to differ and "
         1147  +            echo "they are required to differ also after normalization."
         1148  +            echo ""
         1149  +            echo "GUID=='3f8afd21-08d6-487f-b3cb-f1e0305090e7'"
         1150  +            echo "GUID=='$S_GUID_CMP'"   # comparison
         1151  +            echo "GUID=='$S_GUID_CRAWL'" # tree crawling at the schematic
         1152  +            if [ "$S_GUID" != "" ]; then 
         1153  +                echo "GUID=='$S_GUID'"   # GUID as an input parameter
         1154  +            fi
         1155  +            echo ""
         1156  +            #----
         1157  +            cd $S_FP_ORIG
         1158  +            exit 1 # exit with error
         1159  +        fi
         1160  +    fi
         1161  +} # func_mmmv_assert_file_paths_differ_t1
   274   1162   
   275   1163   
   276   1164   #--------------------------------------------------------------------------
   277   1165   # Activity aliases for comfort.
   278   1166   
   279   1167   if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "up" ]; then
   280   1168       S_ACTIVITY_OF_THIS_SCRIPT="overwrite_remote_with_local"
................................................................................
   307   1195       S_ACTIVITY_OF_THIS_SCRIPT="help"
   308   1196   fi
   309   1197   if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "-help" ]; then
   310   1198       S_ACTIVITY_OF_THIS_SCRIPT="help"
   311   1199   fi
   312   1200   #--------
   313   1201   if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "rm" ]; then
   314         -    S_ACTIVITY_OF_THIS_SCRIPT="shred_local_copy"
         1202  +    S_ACTIVITY_OF_THIS_SCRIPT="delete_local_copy"
   315   1203   fi
   316   1204   if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "del" ]; then
   317         -    S_ACTIVITY_OF_THIS_SCRIPT="shred_local_copy"
         1205  +    S_ACTIVITY_OF_THIS_SCRIPT="delete_local_copy"
   318   1206   fi
   319   1207   if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "delete" ]; then
   320         -    S_ACTIVITY_OF_THIS_SCRIPT="shred_local_copy"
         1208  +    S_ACTIVITY_OF_THIS_SCRIPT="delete_local_copy"
   321   1209   fi
   322   1210   #--------
   323   1211   if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "info" ]; then
   324   1212       S_ACTIVITY_OF_THIS_SCRIPT="about"
   325   1213   fi
   326   1214   if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "--info" ]; then
   327   1215       S_ACTIVITY_OF_THIS_SCRIPT="about"
................................................................................
   376   1264                       if [ "$2" != "" ]; then
   377   1265                           if [ "$2" == "use_autogenerated_commit_message" ]; then
   378   1266                               if [ "$3" != "" ]; then
   379   1267                                   echo ""
   380   1268                                   echo "If the first console argument is \"overwrite_local_with_remote\" and"
   381   1269                                   echo "the second console argument is \"use_autogenerated_commit_message\", "
   382   1270                                   echo "then there should not be a 3. console argument."
   383         -                                echo "GUID=='25ec1eb1-c417-45e4-a3c1-42e0800180e7'"
         1271  +                                echo "GUID=='468fa904-55da-4388-81cb-f1e0305090e7'"
   384   1272                                   S_ACTIVITY_OF_THIS_SCRIPT="help"
   385   1273                                   SB_EXIT_WITH_ERROR="t"
   386   1274                               fi
   387   1275                           else
   388   1276                               if [ "$2" == "read_commit_message_from_file" ]; then
   389   1277                                   S_FP_MESSAGE_FILE_CANDIDATE="$3" # file path candidate
   390   1278                                   if [ "$S_FP_MESSAGE_FILE_CANDIDATE" == "" ]; then
................................................................................
   391   1279                                       echo ""
   392   1280                                       echo "If the first console argument is "
   393   1281                                       echo "\"overwrite_local_with_remote\" and"
   394   1282                                       echo "the second console argument is "
   395   1283                                       echo "\"read_commit_message_from_file\", "
   396   1284                                       echo "then there should be also a 3. console argument "
   397   1285                                       echo "that is expected to be a file path to a text file."
   398         -                                    echo "GUID=='22d36238-7319-44df-94c1-42e0800180e7'"
         1286  +                                    echo "GUID=='559c7db3-15af-4a7d-bdbb-f1e0305090e7'"
   399   1287                                       S_ACTIVITY_OF_THIS_SCRIPT="help"
   400   1288                                       SB_EXIT_WITH_ERROR="t"
   401   1289                                   fi
   402   1290                                   if [ "$SB_EXIT_WITH_ERROR" == "f" ]; then
   403   1291                                       if [ "$4" != "" ]; then
   404   1292                                           echo ""
   405   1293                                           echo "If the first console argument is "
................................................................................
   407   1295                                           echo "the second console argument is "
   408   1296                                           echo "\"read_commit_message_from_file\", "
   409   1297                                           echo "then there should be exactly 3. console arguments, "
   410   1298                                           echo "not 4 or more. Unfortunately the 4. argument is currently "
   411   1299                                           echo "---citation--start---"
   412   1300                                           echo "$4"
   413   1301                                           echo "---citation--end-----"
   414         -                                        echo "GUID=='82b95a2e-d998-42d9-85b1-42e0800180e7'"
         1302  +                                        echo "GUID=='5e662e45-13a1-499b-9dbb-f1e0305090e7'"
   415   1303                                           S_ACTIVITY_OF_THIS_SCRIPT="help"
   416   1304                                           SB_EXIT_WITH_ERROR="t"
   417   1305                                       fi
   418   1306                                   fi
   419   1307                                   if [ "$SB_EXIT_WITH_ERROR" == "f" ]; then
   420   1308                                       if [ ! -e "$S_FP_MESSAGE_FILE_CANDIDATE" ]; then 
   421   1309                                           echo ""
   422   1310                                           echo "The commit message file path candidate "
   423   1311                                           echo "references either a missing file or "
   424   1312                                           echo "a broken symlink."
   425         -                                        echo "GUID=='2c96ab55-cde4-4f75-83b1-42e0800180e7'"
         1313  +                                        echo "GUID=='15f6e772-31ba-4f5e-97bb-f1e0305090e7'"
   426   1314                                           S_ACTIVITY_OF_THIS_SCRIPT="help"
   427   1315                                           SB_EXIT_WITH_ERROR="t"
   428   1316                                       fi
   429   1317                                   fi 
   430   1318                                   if [ "$SB_EXIT_WITH_ERROR" == "f" ]; then
   431   1319                                       if [ -d "$S_FP_MESSAGE_FILE_CANDIDATE" ]; then 
   432   1320                                           echo ""
   433   1321                                           echo "The commit message file path candidate "
   434   1322                                           echo "references a folder, but it should "
   435   1323                                           echo "reference a text file."
   436         -                                        echo "GUID=='6033bc44-becc-49dc-b2b1-42e0800180e7'"
         1324  +                                        echo "GUID=='3225928c-0920-4018-95bb-f1e0305090e7'"
   437   1325                                           S_ACTIVITY_OF_THIS_SCRIPT="help"
   438   1326                                           SB_EXIT_WITH_ERROR="t"
   439   1327                                       fi
   440   1328                                   fi
   441   1329                                   if [ "$SB_EXIT_WITH_ERROR" == "f" ]; then
   442   1330                                       S_TMP_0="`filesize $S_FP_MESSAGE_FILE_CANDIDATE`"
   443   1331                                       S_TMP_1="`ruby -e \"s_out='OK'; if (2000<$S_TMP_0) then s_out='too_big' end; print(s_out);\"`"
   444   1332                                       if [ "$S_TMP_1" == "too_big" ]; then
   445   1333                                           echo ""
   446   1334                                           echo "The commit message file path "
   447   1335                                           echo "references a file that has a size of $S_TMP_0 bytes."
   448   1336                                           echo "The suspicion is that it is a wrong file. "
   449   1337                                           echo "because a commit message is usually not that lengthy."
   450         -                                        echo "GUID=='29330323-2f96-4065-b1b1-42e0800180e7'"
         1338  +                                        echo "GUID=='21090045-08fe-4487-81bb-f1e0305090e7'"
   451   1339                                           S_ACTIVITY_OF_THIS_SCRIPT="help"
   452   1340                                           SB_EXIT_WITH_ERROR="t"
   453   1341                                       else
   454   1342                                           if [ "$S_TMP_0" == "0" ]; then
   455   1343                                               echo ""
   456   1344                                               echo "The commit message file path "
   457   1345                                               echo "references a file that has a size of 0 (zero) bytes."
................................................................................
   461   1349                                               echo ""
   462   1350                                               echo "    \"use_autogenerated_commit_message\""
   463   1351                                               echo ""
   464   1352                                               echo "in stead of the option "
   465   1353                                               echo ""
   466   1354                                               echo "    \"read_commit_message_from_file\" ."
   467   1355                                               echo ""
   468         -                                            echo "GUID=='8d218548-7102-4c19-b4b1-42e0800180e7'"
         1356  +                                            echo "GUID=='a539fb61-243d-4e0c-82bb-f1e0305090e7'"
   469   1357                                               S_ACTIVITY_OF_THIS_SCRIPT="help"
   470   1358                                               SB_EXIT_WITH_ERROR="t"
   471   1359                                           fi
   472   1360                                       fi
   473   1361                                   fi 
   474   1362                                   if [ "$SB_EXIT_WITH_ERROR" == "f" ]; then
   475   1363                                       S_TMP_0="`file --mime-type $S_FP_MESSAGE_FILE_CANDIDATE | grep text `"
................................................................................
   478   1366                                           echo "The commit message file path "
   479   1367                                           echo "references a file that has a  MIME type of "
   480   1368                                           echo ""
   481   1369                                           echo "`file --mime-type $S_FP_MESSAGE_FILE_CANDIDATE`"
   482   1370                                           echo ""
   483   1371                                           echo "The commit message file must be a text file and "
   484   1372                                           echo "text files have the string \"text\" in their MIME type name."
   485         -                                        echo "GUID=='5b813cf1-4908-45e9-91b1-42e0800180e7'"
         1373  +                                        echo "GUID=='0e00aa42-a7dd-4e63-b2ab-f1e0305090e7'"
   486   1374                                           S_ACTIVITY_OF_THIS_SCRIPT="help"
   487   1375                                           SB_EXIT_WITH_ERROR="t"
   488   1376                                       fi
   489   1377                                   fi 
   490   1378                               fi # read_commit_message_from_file
   491   1379                           fi
   492   1380                       fi
   493   1381                   else
   494         -                    if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "shred_local_copy" ]; then
         1382  +                    if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "delete_local_copy" ]; then
   495   1383                           if [ "$2" != "" ]; then # the 2. arg is optional here
   496   1384                               if [ "$2" != "$S_ARGNAME_ACTIVITY_SHRED_ARG_2" ]; then 
   497   1385                                   echo ""
   498         -                                echo "If the first console argument is \"shred_local_copy\", then"
         1386  +                                echo "If the first console argument is \"delete_local_copy\", then"
   499   1387                                   echo "the second console argument is allowed to be only "
   500   1388                                   echo ""
   501   1389                                   echo "    \"$S_ARGNAME_ACTIVITY_SHRED_ARG_2\", without quotation marks."
   502         -                                echo "GUID=='666fb445-f5b0-4a7f-92b1-42e0800180e7'"
         1390  +                                echo "GUID=='53d97712-0caf-4847-b5ab-f1e0305090e7'"
   503   1391                                   S_ACTIVITY_OF_THIS_SCRIPT="help"
   504   1392                                   SB_EXIT_WITH_ERROR="t"
   505   1393                               fi
   506   1394                           fi
   507   1395                       else
   508   1396                           if [ "$S_ACTIVITY_OF_THIS_SCRIPT" != "print_script_version" ]; then
   509   1397                               if [ "$S_ACTIVITY_OF_THIS_SCRIPT" != "help" ]; then
   510   1398                                   echo ""
   511   1399                                   echo "The very first console argument "
   512   1400                                   echo "of this script is expected to be "
   513   1401                                   echo "a command that is specific to this script."
   514         -                                echo "GUID=='3b955712-bcfb-44f6-b3b1-42e0800180e7'"
         1402  +                                echo "GUID=='5d8d1e92-ac26-408a-81ab-f1e0305090e7'"
   515   1403                                   S_ACTIVITY_OF_THIS_SCRIPT="help"
   516   1404                                   SB_EXIT_WITH_ERROR="t"
   517   1405                               fi
   518   1406                           fi
   519   1407                       fi
   520   1408                   fi
   521   1409               fi
................................................................................
   531   1419       echo "    clone_all    <remote repository url>"
   532   1420       echo "    clone_public <remote repository url>"
   533   1421       echo "    overwrite_local_with_remote"
   534   1422       echo ""
   535   1423       echo "    overwrite_remote_with_local (use_autogenerated_commit_message)?"
   536   1424       echo "    overwrite_remote_with_local read_commit_message_from_file <path to a text file>"
   537   1425       echo ""
   538         -    echo "    shred_local_copy ($S_ARGNAME_ACTIVITY_SHRED_ARG_2)?"
         1426  +    echo "    delete_local_copy ($S_ARGNAME_ACTIVITY_SHRED_ARG_2)?"
   539   1427       echo "    help"
   540   1428       echo "    print_script_version"
   541   1429       echo "    exit # just for testing"
   542   1430       echo ""
   543   1431       #----
   544   1432       cd $S_FP_ORIG
   545   1433       if [ "$SB_EXIT_WITH_ERROR" == "t" ]; then
................................................................................
   560   1448   # To allow the version to be used as sub-part of file names and 
   561   1449   # folder names, the version must not contain any spaces, line breaks
   562   1450   # and other characters that have a special meaning in Bash.
   563   1451   #
   564   1452   # If the version ID did not match the GUID regex, then I would have to 
   565   1453   # write a long comment about it not being allowed to match the 
   566   1454   # GUID regex. :-D 
   567         -S_VERSION_OF_THIS_SCRIPT="5e72de55-a03d-417b-9cd1-42e0800180e7"
         1455  +S_VERSION_OF_THIS_SCRIPT="23dc37cc-4d31-4444-a52c-f1e0305090e7"
   568   1456   if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "print_script_version" ]; then
   569   1457       echo "The version of this script is: $S_VERSION_OF_THIS_SCRIPT"
   570   1458       #----
   571   1459       cd $S_FP_ORIG
   572   1460       exit 0
   573   1461   fi 
   574   1462   
................................................................................
   643   1531           fi
   644   1532       fi
   645   1533       #----
   646   1534       if [ "$SB_THROW" == "t" ]; then
   647   1535           echo ""
   648   1536           echo "This Bash script is flawed. "
   649   1537           echo "fun_assertion_t1() assertion failed."
   650         -        echo "GUID=='29da426c-b117-441e-93b1-42e0800180e7'"
         1538  +        echo "GUID=='c2afa84b-ad9b-41b4-a4ab-f1e0305090e7'"
   651   1539           echo ""
   652   1540           #----
   653   1541           cd $S_FP_ORIG
   654   1542           exit 1
   655   1543       fi
   656   1544   } # fun_assertion_t1
   657   1545   
................................................................................
   668   1556           echo "The directory "
   669   1557           echo "`pwd`"
   670   1558           echo "does not contain a Fossil repository file named "
   671   1559           echo ""
   672   1560           echo "    $S_FP_FOSSILFILE_NAME"
   673   1561           echo ""
   674   1562           echo "Aborting script."
   675         -        echo "GUID=='5950191d-deaf-4abf-a1a1-42e0800180e7'"
         1563  +        echo "GUID=='b6307f42-cfba-4f42-b4ab-f1e0305090e7'"
   676   1564           echo ""
   677   1565           #----
   678   1566           cd $S_FP_ORIG
   679   1567           exit 1
   680   1568       fi
   681   1569       fun_sandbox_folder_or_symlink_exists
   682   1570       if [ "$SB_SANDBOX_DIR_EXISTS" == "f" ]; then
................................................................................
   684   1572           echo "The directory "
   685   1573           echo "`pwd`"
   686   1574           echo "does not contain a directory named "
   687   1575           echo ""
   688   1576           echo "    $S_FP_SANDBOX_DIRECTORY_NAME"
   689   1577           echo ""
   690   1578           echo "Aborting script."
   691         -        echo "GUID=='653dfc68-75da-4e5b-8ea1-42e0800180e7'"
         1579  +        echo "GUID=='2619a005-53ea-46b9-a79b-f1e0305090e7'"
   692   1580           echo ""
   693   1581           #----
   694   1582           cd $S_FP_ORIG
   695   1583           exit 1
   696   1584       fi
   697   1585   } # fun_assert_repository_local_copy_existence
   698   1586   
................................................................................
   704   1592           echo "`pwd`"
   705   1593           echo "already contain a file named "
   706   1594           echo ""
   707   1595           echo "    $S_FP_FOSSILFILE_NAME"
   708   1596           echo ""
   709   1597           echo "To avoid overwriting an existing local copy, this script is aborted"
   710   1598           echo "and nothing is downloaded/uploaded by this script."
   711         -        echo "GUID=='d6e07f2d-e707-44c5-a5a1-42e0800180e7'"
         1599  +        echo "GUID=='3cdf8c33-e911-4ecf-819b-f1e0305090e7'"
   712   1600           echo ""
   713   1601           #----
   714   1602           cd $S_FP_ORIG
   715   1603           exit 1
   716   1604       fi
   717   1605       if [ "$SB_SANDBOX_DIR_EXISTS" == "t" ]; then
   718   1606           echo ""
................................................................................
   720   1608           echo "`pwd`"
   721   1609           echo "already contains a directory named "
   722   1610           echo ""
   723   1611           echo "    $S_FP_SANDBOX_DIRECTORY_NAME"
   724   1612           echo ""
   725   1613           echo "To avoid overwriting an existing local copy, this script is aborted"
   726   1614           echo "and nothing is downloaded/uploaded by this script."
   727         -        echo "GUID=='da297b50-e286-423d-93a1-42e0800180e7'"
         1615  +        echo "GUID=='e054e73b-52b7-4999-929b-f1e0305090e7'"
   728   1616           echo ""
   729   1617           #----
   730   1618           cd $S_FP_ORIG
   731   1619           exit 1
   732   1620       fi
   733   1621   } # fun_assert_the_lack_of_repository_local_copy_t1
   734   1622   
................................................................................
   751   1639   #--------------------------------------------------------------------------
   752   1640   fun_last_minute_checks_t1() {
   753   1641       # Last minute checks, just to be sure.
   754   1642       local S_FP_FORBIDDEN_VALUE=$1
   755   1643       if [ "$S_FP_FORBIDDEN_VALUE" == "/" ]; then
   756   1644           echo ""
   757   1645           echo "This Bash script is flawed."
   758         -        echo "GUID=='c1d71016-36d5-40de-b4a1-42e0800180e7'"
         1646  +        echo "GUID=='3c4e5af3-7901-474c-939b-f1e0305090e7'"
   759   1647           echo ""
   760   1648           #----
   761   1649           cd $S_FP_ORIG
   762   1650           exit 1
   763   1651       fi
   764   1652       if [ "$S_FP_FORBIDDEN_VALUE" == "$HOME" ]; then
   765   1653           echo ""
   766   1654           echo "This Bash script is flawed."
   767         -        echo "GUID=='4eed6a14-0b10-41a7-8aa1-42e0800180e7'"
         1655  +        echo "GUID=='c200ef46-b3f7-4204-919b-f1e0305090e7'"
   768   1656           echo ""
   769   1657           #----
   770   1658           cd $S_FP_ORIG
   771   1659           exit 1
   772   1660       fi
   773   1661       if [ "$S_FP_FORBIDDEN_VALUE" == "/home" ]; then
   774   1662           echo ""
   775   1663           echo "This Bash script is flawed."
   776         -        echo "GUID=='8e3a2d2e-8602-4a57-a2a1-42e0800180e7'"
         1664  +        echo "GUID=='d2a65b5e-0591-4332-948b-f1e0305090e7'"
   777   1665           echo ""
   778   1666           #----
   779   1667           cd $S_FP_ORIG
   780   1668           exit 1
   781   1669       fi
   782   1670       if [ "$S_FP_FORBIDDEN_VALUE" == "/root" ]; then
   783   1671           echo ""
   784   1672           echo "This Bash script is flawed."
   785         -        echo "GUID=='16d5bccc-3d47-4536-8591-42e0800180e7'"
         1673  +        echo "GUID=='03b089fe-baa7-4a68-b38b-f1e0305090e7'"
   786   1674           echo ""
   787   1675           #----
   788   1676           cd $S_FP_ORIG
   789   1677           exit 1
   790   1678       fi
   791   1679       if [ "$S_FP_FORBIDDEN_VALUE" == "/etc" ]; then
   792   1680           echo ""
   793   1681           echo "This Bash script is flawed."
   794         -        echo "GUID=='407a2041-4672-4819-8391-42e0800180e7'"
         1682  +        echo "GUID=='0062ae2c-e3a2-4764-b28b-f1e0305090e7'"
   795   1683           echo ""
   796   1684           #----
   797   1685           cd $S_FP_ORIG
   798   1686           exit 1
   799   1687       fi
   800   1688       if [ "$S_FP_FORBIDDEN_VALUE" == "/usr" ]; then
   801   1689           echo ""
   802   1690           echo "This Bash script is flawed."
   803         -        echo "GUID=='f121833f-5f5a-4f4b-8391-42e0800180e7'"
         1691  +        echo "GUID=='9de55d34-dbca-4803-918b-f1e0305090e7'"
   804   1692           echo ""
   805   1693           #----
   806   1694           cd $S_FP_ORIG
   807   1695           exit 1
   808   1696       fi
   809   1697   } # fun_last_minute_checks_t1
   810   1698   
................................................................................
   827   1715   fun_folder_is_empty_t1 "$S_FP_DIR"
   828   1716   fun_assertion_t1 "$SB_FOLDER_IS_EMPTY"
   829   1717   if [ "$SB_FOLDER_IS_EMPTY" == "t" ]; then
   830   1718       echo ""
   831   1719       echo "This Bash script is flawed. The "
   832   1720       echo "$S_FP_DIR" 
   833   1721       echo "can not possibly be empty, because it contains "
   834         -    echo "at least one file, whcih is "
         1722  +    echo "at least one file, which is "
   835   1723       echo "this very same Bash script that outputs the current error message."
   836         -    echo "GUID=='c4a3f01e-dd50-43b5-bf91-42e0800180e7'"
         1724  +    echo "GUID=='fb573a47-7195-4c06-b18b-f1e0305090e7'"
   837   1725       echo ""
   838   1726       #----
   839   1727       cd $S_FP_ORIG
   840   1728       exit 1
   841   1729   fi
   842   1730   
   843   1731   #--------------------------------------------------------------------------
................................................................................
   978   1866               SB_SANDBOX_CONTENT_MIGHT_HAVE_BEEN_CHANGED="t"
   979   1867               fun_last_minute_checks_t1 "`pwd`"
   980   1868               if [ "$S_FP_SANDBOX" == "`pwd`" ]; then
   981   1869                   rm -fr ./*
   982   1870               else
   983   1871                   echo ""
   984   1872                   echo "This Bash script is flawed."
   985         -                echo "GUID=='c217ab1a-3f04-4320-b391-42e0800180e7'"
         1873  +                echo "GUID=='20848e2d-db76-40f0-b18b-f1e0305090e7'"
   986   1874                   echo ""
   987   1875                   #----
   988   1876                   cd $S_FP_ORIG
   989   1877                   exit 1
   990   1878               fi
   991   1879           fi
   992   1880           mv -f $S_TMP_FOR_LOCAL/* $S_FP_SANDBOX/ # the -f is for empty source
................................................................................
   995   1883           rm -fr $S_TMP_FOR_LOCAL
   996   1884           #----
   997   1885           fun_folder_is_empty_t1 "$S_FP_SANDBOX"
   998   1886           if [ "$SB_FOLDER_IS_EMPTY" == "f" ]; then
   999   1887               if [ "$S_FP_SANDBOX" != "`pwd`" ]; then
  1000   1888                   echo ""
  1001   1889                   echo "This Bash script is flawed."
  1002         -                echo "GUID=='5ddc6156-c835-44f0-a491-42e0800180e7'"
         1890  +                echo "GUID=='74c20b5b-81c4-4dea-a17b-f1e0305090e7'"
  1003   1891                   echo ""
  1004   1892                   #----
  1005   1893                   cd $S_FP_ORIG
  1006   1894                   exit 1
  1007   1895               fi
  1008   1896               find . -name '*' | xargs fossil add --force --dotfiles --case-sensitive TRUE  
  1009   1897               SB_SANDBOX_CONTENT_MIGHT_HAVE_BEEN_CHANGED="t"
................................................................................
  1049   1937                               echo "The file or symlink to it was fine at "
  1050   1938                               echo "the start of this script, it passed the various tests, "
  1051   1939                               echo "but for some reason it got deleted or its target . "
  1052   1940                               echo "got deleted. If the commit message file or"
  1053   1941                               echo "the symlink target resided within the sandbox, then "
  1054   1942                               echo "a recommendation is to use a file that resides "
  1055   1943                               echo "outside of the sandbox."
  1056         -                            echo "GUID=='549bc742-cdbf-43a6-8291-42e0800180e7'"
         1944  +                            echo "GUID=='489d0043-ac2a-46ae-857b-f1e0305090e7'"
  1057   1945                               echo ""
  1058   1946                               #----
  1059   1947                               cd $S_FP_ORIG
  1060   1948                               exit 1
  1061   1949                           fi
  1062   1950                           if [ -d "$S_FP_MESSAGE_FILE_CANDIDATE" ]; then 
  1063   1951                               # folder or a symlink to a folder
  1064   1952                               echo ""
  1065   1953                               echo "The commit message file path does not reference "
  1066   1954                               echo "a file. It references a folder or a symlink to a folder."
  1067   1955                               echo "The file or symlink to it was fine at "
  1068   1956                               echo "the start of this script, it passed the various tests, "
  1069   1957                               echo "but for some reason there were changes. "
  1070         -                            echo "GUID=='305146e5-d1d0-41c3-8591-42e0800180e7'"
         1958  +                            echo "GUID=='1c1054d1-d44f-4830-a47b-f1e0305090e7'"
  1071   1959                               echo ""
  1072   1960                               #----
  1073   1961                               cd $S_FP_ORIG
  1074   1962                               exit 1
  1075   1963                           fi
  1076   1964                           cat $S_FP_MESSAGE_FILE_CANDIDATE > $S_TMP_FOR_COMMIT_MESSAGE
  1077   1965                       # else
................................................................................
  1095   1983       #----
  1096   1984       cd $S_FP_ORIG
  1097   1985       exit 0
  1098   1986   fi # overwrite_remote_with_local
  1099   1987   
  1100   1988   
  1101   1989   #--------------------------------------------------------------------------
  1102         -if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "shred_local_copy" ]; then
         1990  +if [ "$S_ACTIVITY_OF_THIS_SCRIPT" == "delete_local_copy" ]; then
  1103   1991       #--------
  1104   1992       SB_THERE_IS_SOMETHING_TO_DELETE="f"
  1105   1993       if [ "$SB_FOSSILFILE_EXISTS" == "t" ]; then
  1106   1994           SB_THERE_IS_SOMETHING_TO_DELETE="t"
  1107   1995       fi
  1108   1996       if [ "$SB_SANDBOX_DIR_EXISTS" == "t" ]; then
  1109   1997           SB_THERE_IS_SOMETHING_TO_DELETE="t"
................................................................................
  1117   2005               # Includes the $2=="" case
  1118   2006               # id est if the control flow is in here, then there 
  1119   2007               # is a need to prompt for confirmation.
  1120   2008               # The skipping of the prompt is necessary for
  1121   2009               # software that use this script as its sub-component.
  1122   2010               #--------
  1123   2011               echo ""
  1124         -            echo "The command \"shred_local_copy\" deletes "
         2012  +            echo "The command \"delete_local_copy\" deletes "
  1125   2013               echo "the repository file, the sandbox and "
  1126   2014               echo "the associated automatically created archives."
  1127   2015               echo ""
  1128   2016               read -p "Proceed with deletion?  (Yes/whatever_else)  " S_TMP_0
  1129   2017               S_TMP_1="`echo $S_TMP_0 | gawk '{print tolower($1)}'`"
  1130   2018               if [ "$S_TMP_1" == "yes" ]; then
  1131   2019                   echo ""
................................................................................
  1132   2020                   printf "Deleting ... "
  1133   2021               else
  1134   2022                   fun_exit_without_any_errors_t1
  1135   2023               fi
  1136   2024          fi
  1137   2025       fi
  1138   2026       #--------
  1139         -    if [ "$SB_FOSSILFILE_EXISTS" == "t" ]; then
  1140         -        cd $S_FP_DIR  # just in case
  1141         -        # The     shred "-f" option re-sets file access permissions as needed.
  1142         -        nice -n10 shred  -f --remove $S_FP_FOSSILFILE  
  1143         -    fi
  1144         -    #--------
  1145         -    if [ "$SB_SANDBOX_DIR_EXISTS" == "t" ]; then
  1146         -        cd $S_FP_SANDBOX
  1147         -        fun_last_minute_checks_t1 "`pwd`"
  1148         -        #--------
  1149         -        # The S_TMP_0 is to suppress shred output.
  1150         -        S_TMP_0="`find . -name '*' | xargs shred -f --remove 2>/dev/null`"
  1151         -        #----
  1152         -        cd $S_FP_DIR  # step out of the sandbox directory
  1153         -        fun_last_minute_checks_t1 "$S_FP_SANDBOX"
  1154         -        chmod -f -R 0700 $S_FP_SANDBOX 
  1155         -        rm -fr $S_FP_SANDBOX 
  1156         -    fi
         2027  +    cd $S_FP_ORIG # to make sure that we're not in the sandbox directory and 
         2028  +                  # to make sure that we're not in the archive directory
         2029  +    #----
         2030  +    # The next 3 checks can bee seen to form a complete graph, 
         2031  +    # in this case a triangle, with corner points  
         2032  +    # S_FP_SANDBOX, S_FP_ARCHIVES, S_FP_FOSSILFILE connected
         2033  +    # with lines of type "!=".
         2034  +    S_GUID="470c7051-b162-4cba-b51c-f1e0305090e7"
         2035  +    func_mmmv_assert_file_paths_differ_t1 "$S_FP_FOSSILFILE" "$S_FP_SANDBOX" "$S_GUID"
         2036  +
         2037  +    S_GUID="45b8df6a-0c67-4d1e-a71c-f1e0305090e7"
         2038  +    func_mmmv_assert_file_paths_differ_t1 "$S_FP_SANDBOX" "$S_FP_ARCHIVES" "$S_GUID"
         2039  +
         2040  +    S_GUID="42226761-7b9d-4cfb-bc1c-f1e0305090e7"
         2041  +    func_mmmv_assert_file_paths_differ_t1 "$S_FP_ARCHIVES" "$S_FP_FOSSILFILE" "$S_GUID"
         2042  +    #----
         2043  +    # The next 3 checks turn the triangle to a tetrahedron, where  
         2044  +    # the S_FP_ORIG is the "top of the pyramid".
         2045  +    S_GUID="a9379a5b-d3aa-419b-820c-f1e0305090e7"
         2046  +    func_mmmv_assert_file_paths_differ_t1 "$S_FP_ORIG" "$S_FP_FOSSILFILE" "$S_GUID"
         2047  +    
         2048  +    S_GUID="6d2d0251-9d35-4747-940c-f1e0305090e7"
         2049  +    func_mmmv_assert_file_paths_differ_t1 "$S_FP_ORIG" "$S_FP_ARCHIVES" "$S_GUID"
         2050  +
         2051  +    S_GUID="3b972413-c33d-4867-910c-f1e0305090e7"
         2052  +    func_mmmv_assert_file_paths_differ_t1 "$S_FP_ORIG" "$S_FP_SANDBOX" "$S_GUID"
  1157   2053       #--------
         2054  +    cd $S_FP_ORIG # just in case
         2055  +    SB_OK_TO_USE_RM_IN_STEAD_OF_SHRED="t" # shred is still used, if available
         2056  +    if [ "$SB_FOSSILFILE_EXISTS" == "t" ]; then
         2057  +        fun_last_minute_checks_t1 "`pwd`"
         2058  +        func_mmmv_shred_t1 "$S_FP_FOSSILFILE" "$SB_OK_TO_USE_RM_IN_STEAD_OF_SHRED"
         2059  +    fi
         2060  +    if [ "$SB_SANDBOX_DIR_EXISTS" == "t" ]; then
         2061  +        fun_last_minute_checks_t1 "`pwd`"
         2062  +        func_mmmv_shred_t1 "$S_FP_SANDBOX" "$SB_OK_TO_USE_RM_IN_STEAD_OF_SHRED"
         2063  +    fi
  1158   2064       if [ "$SB_ARCHIVE_DIR_EXISTS" == "t" ]; then
  1159         -        cd $S_FP_ARCHIVES 
  1160   2065           fun_last_minute_checks_t1 "`pwd`"
  1161         -        #--------
  1162         -        # The S_TMP_0 is to suppress shred output.
  1163         -        S_TMP_0="`find . -name '*' | xargs shred -f --remove 2>/dev/null`" 
  1164         -        #----
  1165         -        cd $S_FP_DIR  # step out of the archive directory
  1166         -        fun_last_minute_checks_t1 "$S_FP_ARCHIVES"
  1167         -        chmod -f -R 0700 $S_FP_ARCHIVES
  1168         -        rm -fr $S_FP_ARCHIVES 
         2066  +        func_mmmv_shred_t1 "$S_FP_ARCHIVES" "$SB_OK_TO_USE_RM_IN_STEAD_OF_SHRED"
  1169   2067       fi
  1170   2068       #--------
  1171   2069       if [ "$SB_THERE_IS_SOMETHING_TO_DELETE" == "t" ]; then 
  1172   2070           if [ "$2" != "$S_ARGNAME_ACTIVITY_SHRED_ARG_2" ]; then 
  1173   2071               echo "✓"
  1174   2072               echo ""
  1175   2073           fi
  1176   2074       fi
  1177   2075       #--------
  1178   2076       cd $S_FP_ORIG
  1179   2077       exit 0
  1180         -fi # shred_local_copy
         2078  +fi # delete_local_copy
  1181   2079   
  1182   2080   
  1183   2081   #--------------------------------------------------------------------------
  1184   2082   # All possible actions must have been described
  1185   2083   # above this code block.
  1186   2084   echo ""
  1187   2085   echo "This Bash script is flawed."
  1188         -echo "GUID=='450c2dad-e133-4bc1-8681-42e0800180e7'"
         2086  +echo "GUID=='1b3f0b52-848d-494a-a47b-f1e0305090e7'"
  1189   2087   echo ""
  1190   2088   #----
  1191   2089   cd $S_FP_ORIG
  1192   2090   exit 1
  1193   2091   
  1194   2092   #==========================================================================
  1195   2093