Created
September 10, 2022 07:32
-
-
Save kin29/8950d25cab8bd877efff88764515cf66 to your computer and use it in GitHub Desktop.
[shell]seqコマンド(+シェル変数,forループ)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ## シェル変数 | |
| x=3 | |
| echo $x #echo xではない。 | |
| # コマンドを変数に入れたい時は「`」で囲む | |
| d=`date` | |
| echo $d | |
| ## seqコマンド | |
| # 1から10までの数値を並べる | |
| seq 1 10 | |
| ## forループ | |
| for a in 1 2 3; do echo $a; done | |
| # seq 1 3は文字じゃなくてコマンドなので「`」で囲む | |
| for b in `seq 1 3`; do echo $b; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment