Skip to content

Instantly share code, notes, and snippets.

@kjunichi
Created December 8, 2023 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjunichi/4fe2f2f07cd3a78479beb0578ebe2c1e to your computer and use it in GitHub Desktop.
Save kjunichi/4fe2f2f07cd3a78479beb0578ebe2c1e to your computer and use it in GitHub Desktop.

シェルスクリプトでファイルを一行ごとに読み込む

#!/bin/sh

IFS_BACKUP=$IFS
IFS=$'\n'

i=0
for line in `cat fileRead.sh`
do
    echo "line[$i] :$line"
    i=$((i+1))
done
IFS=$IFS_BACKUP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment