[shell]seqコマンド(+シェル変数,forループ)
This file contains 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