当前位置:网站首页>Shell function call
Shell function call
2022-07-21 04:20:00 【Oreo WM】
List of articles
stay shell Script , When some commands or operations need to be used frequently , It's too cumbersome to rewrite every time , Then we can use the function , When needed , Just call the function directly .
One . Function basic format
Function, write some command sequences together in format , It is convenient to reuse the command sequence
Function definition format :
Method 1 :
function Function name {
Command sequence
return x # Show end of function
}
Method 2 :
Function name (){
Command sequence
}
Function call : Function name [ Parameters 1][ Parameters 2]
Two . Function call
2.1 Call in function
Call the current function directly in the function
2.2 Function call function
When defining a function , Other functions can also be called inside
2.3 External call
The function's role is in its modularity , Convenient for next use , Call directly to use . So every time we write a script , You can call the previously written function directly , Just make a declaration before use .
2.4 Case study
Use functions to configure local yum Source warehouse
3、 ... and . summary
1. function : Encapsulated reusable code with characteristic functions , It is a bit similar to the command alias
2. Functions can be called directly in functions , It can also be called outside the function ,
3. When calling externally, you must first declare the called function
4. For functions with the same name , Only the last defined function is recognized
边栏推荐
- 离线安装jenkins及离线安装插件
- Don't know how to learn MySQL? It's enough to finish the 50 questions of Niuke! (Part V)
- UML中聚合和组合的区别
- 解读最新ECCV 2022工作:组合式扩散模型
- 【深度学习】使用yolov5对数据进行预标注
- Qu'est - ce qu'un tuyau de rendu et comment dessiner un objet 3D
- Uni app - plugin [app cloud packaging] installation failed! (the app cloud packaging plug-in installation fails when the app is packaged) solution
- List,Set,Map,Queue,Deque,Stack的特点及遍历方式总结
- 条件判断if语句case语句
- UGUI——EventSystems和射线检测
猜你喜欢
随机推荐
二、mysql进程之间关系、配置文件、文件socket、网络socket、mysql密码破解
pycharm 突然无法连接远程服务器
About the road before and after graduation
服务器防火墙软件—iptables
DHCP配置
Jenkins pipeline key for remote deployment
Xshell installation configuration tutorial
结合源码看《我所理解的cocos2dx-3.0》—— 粒子系统
栈模拟队列
Pycharm suddenly cannot connect to the remote server
UGUI——LayoutGroup
UML中聚合和组合的区别
PXE高效网络装机、Kickstart无人值守安装
web框架前戏
pinctrl
Summary of the characteristics and traversal methods of list, set, map, queue, deque and stack
One bite of Stream(4)
买一个能拍蒜的菜刀要多少钱?通过爬虫爬取菜刀价格
Uni app - solution to the failure of the return key of the mobile phone with the embedded web page physics in the app platform (after the embedded WebView web page H5 is packaged, the mobile phone's p
SNAT与DNAT