#!/bin/bash echo "指定するファイルの番号を入力してください。 1 kadai1-1_data.txt 2 kadai1-2_data.txt 3 kadai1-3_data.txt" read number #実行するファイルを指定 case "$number" in "1" ) cat "kadai1-1_data.txt" | tr '\n' ' ' > file.txt ;; "2" ) cat "kadai1-2_data.txt" | tr '\n' ' ' > file.txt ;; "3" ) cat "kadai1-3_data.txt" | tr '\n' ' ' > file.txt ;; "*" ) echo "ERROR" break ;; esac #ファイルの改行をスペースに変換、一行で表示 #123以外の数字が入力された場合ERRORと表示 echo ' ' >> file.txt #結果を改行して表示 cat file.txt | tr '[A-Z]' '[B-ZA-B]' | tr '[a-z]' '[b-za-b]' cat file.txt | tr '[A-Z]' '[C-ZA-C]' | tr '[a-z]' '[c-za-c]' cat file.txt | tr '[A-Z]' '[D-ZA-D]' | tr '[a-z]' '[d-za-d]' cat file.txt | tr '[A-Z]' '[E-ZA-E]' | tr '[a-z]' '[e-za-e]' cat file.txt | tr '[A-Z]' '[F-ZA-F]' | tr '[a-z]' '[f-za-f]' cat file.txt | tr '[A-Z]' '[G-ZA-G]' | tr '[a-z]' '[g-za-g]' cat file.txt | tr '[A-Z]' '[H-ZA-H]' | tr '[a-z]' '[h-za-h]' cat file.txt | tr '[A-Z]' '[I-ZA-I]' | tr '[a-z]' '[i-za-i]' cat file.txt | tr '[A-Z]' '[J-ZA-J]' | tr '[a-z]' '[j-za-j]' cat file.txt | tr '[A-Z]' '[K-ZA-K]' | tr '[a-z]' '[k-za-k]' cat file.txt | tr '[A-Z]' '[L-ZA-L]' | tr '[a-z]' '[l-za-l]' cat file.txt | tr '[A-Z]' '[M-ZA-M]' | tr '[a-z]' '[m-za-m]' cat file.txt | tr '[A-Z]' '[N-ZA-N]' | tr '[a-z]' '[n-za-n]' cat file.txt | tr '[A-Z]' '[O-ZA-O]' | tr '[a-z]' '[o-za-o]' cat file.txt | tr '[A-Z]' '[P-ZA-P]' | tr '[a-z]' '[p-za-p]' cat file.txt | tr '[A-Z]' '[Q-ZA-Q]' | tr '[a-z]' '[q-za-q]' cat file.txt | tr '[A-Z]' '[R-ZA-R]' | tr '[a-z]' '[r-za-r]' cat file.txt | tr '[A-Z]' '[S-ZA-S]' | tr '[a-z]' '[s-za-s]' cat file.txt | tr '[A-Z]' '[T-ZA-T]' | tr '[a-z]' '[t-za-t]' cat file.txt | tr '[A-Z]' '[U-ZA-U]' | tr '[a-z]' '[u-za-u]' cat file.txt | tr '[A-Z]' '[V-ZA-V]' | tr '[a-z]' '[v-za-v]' cat file.txt | tr '[A-Z]' '[W-ZA-W]' | tr '[a-z]' '[w-za-w]' cat file.txt | tr '[A-Z]' '[X-ZA-X]' | tr '[a-z]' '[x-za-x]' cat file.txt | tr '[A-Z]' '[Y-ZA-Y]' | tr '[a-z]' '[y-za-y]' cat file.txt | tr '[A-Z]' '[Z-ZA-Z]' | tr '[a-z]' '[z-za-z]' cat file.txt | tr '[A-Z]' '[A-ZA-A]' | tr '[a-z]' '[a-za-a]' #一文字ずらして表示 rm file.txt #file.txtを削除