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 | |
### awkコマンド | |
# テキストデータの加工や処理などができる。 | |
# 1が表示される | |
echo 1 2 | awk '{print $1}' | |
# 計算もできる | |
# 3(=1+2)が表示される |
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 |
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 | |
## 標準入出力 | |
# キーボードで入力(標準入力)したものがそのままに出力(標準出力)される | |
echo hello! | |
## 出力リダイレクト | |
# 「hello!」という出力結果を画面(標準出力)でなく新規ファイルoutput.txtに出力 | |
echo hello! > output.txt |