当前位置:网站首页>Methods of using arrays as function parameters in shell
Methods of using arrays as function parameters in shell
2022-07-03 08:53:00 【Xiaoping is extraordinary】
#!/bin/bash
function showArr(){
arr=$1
for i in ${arr[*]}; do
echo $i
done
}
regions=("GZ" "SH" "BJ")
# Double quotation marks cannot be less
showArr "${regions[*]}"
exit 0
Output results :
GZ
SH
BJ
边栏推荐
- Find the combination number acwing 886 Find the combination number II
- 求组合数 AcWing 885. 求组合数 I
- ES6 promise learning notes
- [rust note] 10 operator overloading
- [concurrent programming] consistency hash
- 单调栈-84. 柱状图中最大的矩形
- 22-05-26 Xi'an interview question (01) preparation
- Downward compatibility and upward compatibility
- 22-06-27 Xian redis (01) commands for installing five common data types: redis and redis
- [rust notes] 12 closure
猜你喜欢
![[rust notes] 02 ownership](/img/f7/74f8ea3bd697957f9ebfa3e1513fda.png)
[rust notes] 02 ownership

DOM render mount patch responsive system

Unity interactive water ripple post-treatment

Phpstudy 80 port occupied W10 system

Message queue for interprocess communication

22-06-28 Xi'an redis (02) persistence mechanism, entry, transaction control, master-slave replication mechanism
![[redis] redis persistent RDB vs AOF (source code)](/img/57/b6a86c49cedee31fc00dc5d1372023.jpg)
[redis] redis persistent RDB vs AOF (source code)

Find the combination number acwing 886 Find the combination number II

Deeply understand the underlying data structure of MySQL index
![[RPC] RPC remote procedure call](/img/dc/872204ea47fcff04cdb72e18a2a4ef.jpg)
[RPC] RPC remote procedure call
随机推荐
PHP mnemonic code full text 400 words to extract the first letter of each Chinese character
Message pack in C deserializes array objects
PIC16F648A-E/SS PIC16 8位 微控制器,7KB(4Kx14)
Log4j2 vulnerability recurrence and analysis
Redux - learning notes
Escape from heaven and forget what he suffered. In ancient times, it was called the punishment of escape from heaven. Article collection
请求参数的发送和接收
Monotonic stack -42 Connect rainwater
Binary tree sorting (C language, char type)
MySQL index types B-tree and hash
[rust notes] 05 error handling
单调栈-503. 下一个更大元素 II
How to delete CSDN after sending a wrong blog? How to operate quickly
[rust notes] 07 structure
22-05-26 西安 面试题(01)准备
【Rust 笔记】13-迭代器(上)
file_ put_ contents
Unity editor expansion - controls, layouts
Unity editor expansion - window, sub window, menu, right-click menu (context menu)
单调栈-42. 接雨水