1. 变量赋值、查看变量值Linux bash
[xxx@xxx]$ x=1
[xxx@xxx]\$ echo \$x
1
Dos
1
python
>>> x=1
>>> print(x)
2. 注释
Linux bash
# comments will not take effect
Dos
rem comments will not take effect
:: comments will not take effect
python
# comments will not take effect
"""
comments will not take effect
"""
3. 循环(数字风格)
Linux bash
for ((i=0; i<10; ++i))
do
echo $i
done
Dos
for /l %i in (1,1,9) do @echo %i
python
for i in range(1,11):
print(i)
4. 判断
Linux bash
if ((x<2))
then echo good
else echo bad
fi
Dos
if /i %x% lss 2 (echo good) else echo bad
python
if x<2:
print('good')
else:
print('bad')
https://blog.sciencenet.cn/blog-117333-736733.html
上一篇:
我用过的DOS命令下一篇:
星座边界坐标