Bash : Kopeerimiseks-asetamiseks mõeldud kood

From mmmv_kos
Revision as of 08:45, 14 November 2013 by Martinvahi (talk | contribs) (Created page with " Bash = Skriptilõigud = <syntaxhighlight lang=bash> S_TIMESTAMP="`date +%Y`_`date +%m`_`date +%d`_`date +%H`:`date +%M`:`date +%S`" S_FP_prefix="`echo $S_TIMESTAMP`_" ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Bash


Skriptilõigud

S_TIMESTAMP="`date +%Y`_`date +%m`_`date +%d`_`date +%H`:`date +%M`:`date +%S`"
S_FP_prefix="`echo $S_TIMESTAMP`_"


Funktsioonid

func_mmmv_ar_ls_t1() { # AR_TMP_0 | S_FP_LS
    local S_FP_LS=$1
    local AR_0=$( ls --format=commas $S_FP_LS )
    AR_TMP_0=()
    local S_TMP_IFS="$IFS"
    # The IFS is an internal Bash variable, "Internal Field Separator".
    IFS=","
    for s_iter in ${AR_0[@]}; do
         AR_TMP_0+=($s_iter)
    done
    IFS="$S_TMP_IFS"
    if [ -z $IFS ]; then
        unset IFS
    fi
} # func_mmmv_ar_ls_t1

#-------
func_mmmv_ar_ls_t1 "$HOME"
AR_2=${AR_TMP_0[@]}  # array assignment
S_TMP=${#AR_2[@]}
echo "AR_2 length: $S_TMP"
echo ""
for s_iter in ${AR_2[@]}; do
     echo "AR_2 element:[$s_iter]" 
done