Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11.6 Linux shell 用for循环100次的方法 #73

Open
vieyahn2017 opened this issue Nov 6, 2020 · 5 comments
Open

11.6 Linux shell 用for循环100次的方法 #73

vieyahn2017 opened this issue Nov 6, 2020 · 5 comments

Comments

@vieyahn2017
Copy link
Owner

Linux shell 用for循环100次的方法
https://blog.csdn.net/wr339988/article/details/70768499

@vieyahn2017
Copy link
Owner Author

C语言风格

for ((i=1; i<=100; i++))
do
    echo $i
done

@vieyahn2017
Copy link
Owner Author

Python风格(in的使用)

for i in {1..100}
do
    echo $i
done

@vieyahn2017
Copy link
Owner Author

Seq的使用
注意代码中不是单引号。

for i `seq 1 100`
do
    echo $i
done

@vieyahn2017
Copy link
Owner Author

while

i=0
times=100
while [ $i -le $times ]
do
    let 'i++'
    echo $i
done

@vieyahn2017
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant