⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 copyarray.sh

📁 Shall高级编程
💻 SH
字号:
#! /bin/bash# CopyArray.sh## This script written by Michael Zick.# Used here with permission.#  How-To "Pass by Name & Return by Name"#+ or "Building your own assignment statement".CpArray_Mac() {# Assignment Command Statement Builder    echo -n 'eval '    echo -n "$2"                    # Destination name    echo -n '=( ${'    echo -n "$1"                    # Source name    echo -n '[@]} )'# That could all be a single command.# Matter of style only.}declare -f CopyArray                # Function "Pointer"CopyArray=CpArray_Mac               # Statement BuilderHype(){# Hype the array named $1.# (Splice it together with array containing "Really Rocks".)# Return in array named $2.    local -a TMP    local -a hype=( Really Rocks )    $($CopyArray $1 TMP)    TMP=( ${TMP[@]} ${hype[@]} )    $($CopyArray TMP $2)}declare -a before=( Advanced Bash Scripting )declare -a afterecho "Array Before = ${before[@]}"Hype before afterecho "Array After = ${after[@]}"# Too much hype?echo "What ${after[@]:3:2}?"declare -a modest=( ${after[@]:2:1} ${after[@]:3:2} )#                    ---- substring extraction ----echo "Array Modest = ${modest[@]}"# What happened to 'before' ?echo "Array Before = ${before[@]}"exit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -