From 2924ecddd8815e6f20b6e4c9aaba20323b768dcc Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Mar 01 2011 15:58:01 +0000 Subject: Update manual_restoreCrossReferences.sh. --- diff --git a/Scripts/Bash/centos-art/Functions/Manual/manual_restoreCrossReferences.sh b/Scripts/Bash/centos-art/Functions/Manual/manual_restoreCrossReferences.sh index 2c6f122..4ec5978 100755 --- a/Scripts/Bash/centos-art/Functions/Manual/manual_restoreCrossReferences.sh +++ b/Scripts/Bash/centos-art/Functions/Manual/manual_restoreCrossReferences.sh @@ -36,10 +36,19 @@ function manual_restoreCrossReferences { local -a PATTERN local -a REPLACE + local LOCATION='' - # Build the node string using global entry (ENTRY) variable being - # processed currently. - local NODE=$(echo "$ENTRY" \ + # Define entry location. Verify first argument to make this + # function reusable. If no value is passed as first argument use + # entry global information value as default value instead. + if [[ "$1" != '' ]];then + LOCATION="$1" + else + LOCATION="$ENTRY" + fi + + # Build the node string using entry location. + local NODE=$(echo "$LOCATION" \ | cut -d / -f8- \ | tr '/' ' ' \ | sed -r \ @@ -69,9 +78,9 @@ function manual_restoreCrossReferences { # of `label' feature and the `N' command in order to build a # pattern space that includes the newline character in it. Here we # use the `a' letter to name the label we use, followed by N - # command to expand the pattern space, the s command to make the - # pattern replacement using the `g' flag to make it global and - # finaly the command `b' to branch label named `a'. + # command to add a newline to the pattern space, the s command to + # make the pattern replacement using the `g' flag to make it + # global and finaly the command `b' to branch label named `a'. sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${ENTRIES} # Update menu-related cross references. Menu-related cross