LoginSignup
10
10

More than 5 years have passed since last update.

bashでlsの結果を配列に代入して、文字列として連結する

Last updated at Posted at 2014-10-22

java -classpathオプションに指定したくなったので。

FILES=($(ls -1 /path/to/files/))
CONCAT_FILES=$(IFS=';'; shift; echo "${FILES[*]}")
echo ${CONCAT_FILES}

こんな感じに出力される。

a;b;c;d
10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10