当前位置:网站首页>Ji Geng 45 / 90
Ji Geng 45 / 90
2022-04-21 15:38:00 【Programming Capriccio】
Random thoughts on programming
Bash function
1.Bash There are two kinds of syntax for function definition .
# The first one is
fn() {
# codes
}
# The second kind
function fn() {
# codes
}
2. Parameter variable
$1~$9: From the first to the 9 Parameters of .
$0: The name of the script where the function is located .
$#: The total number of arguments to the function .
$@: All the parameters of the function , Parameters are separated by spaces .
$*: All the parameters of the function , Use variables between parameters $IFS The first character of the value is separated by , Default is space , But you can customize .
3.return Command is used to return a value from a function , If the command line executes the function directly , You can give me a command $? Get the return value
function func_return_value {
return 10
}
$ func_return_value
$ echo "Value returned by function is: $?"
Value returned by function is: 10
4.Bash Variables declared directly in the body of a function , Belongs to global variable , The entire script can be read . This requires special care .
You can use local The command declares local variables .
Python Loops and lists
for i in list:
print(i)
i = 0
while i < 5:
print(i)
i+=1
for i in range(0,6):
print(i)
list = [1,2,3]
for i in list:
print(i)
print(list[0])
版权声明
本文为[Programming Capriccio]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211536067879.html
边栏推荐
- LeetCode 141、环形链表
- JUC concurrent learning notes
- How should businesses establish private domain traffic?
- LeetCode 1539、第 k 个缺失的正整数
- 易語言CEF3獲取請求返回的源碼
- 季更48/90
- Installation and uninstallation of MySQL
- How to apply for corporate email? How to register email with mobile phone number?
- swap自动套利机器人生态系统开发模式详解
- With Zhongfu Jinshi's stock speculation, the industry has precipitated for 25 years, and the investment should speak with strength
猜你喜欢
随机推荐
Applet introduction and development tools
返璞归真,多方安全计算要回归到“安全”的本源考虑
LeetCode 386、字典序排数
强到离谱,Transformer为何能闯入CV界秒杀CNN?
Loading and unloading of embedded driver module
Oracle 官宣:腾讯 JDK 18 国内第一!
事务的隔离级别详解
102页新一代数字化转型信息化总体规划方案
万有导航:简洁实用的综合导航网站
季更43/90
Universal navigation: a concise and practical comprehensive navigation website
Oracle official announcement: Tencent JDK 18 ranks first in China!
51页数字转型与“十四五”信息化规划
Plug in development practice of a simple annotation Library
107页企业数字化转型规划设计
Use konvajs three steps to realize a small ball game
Solution de transformation de mot de données de 111 pages Fine Chemical Co., Ltd.
[unity note] l3unity shader learning begins
LeetCode 566、重塑矩阵
Obsidian 自动上传图片到图床——安装PicGo插件并配置









