Bash Script 사용할 때,

shell 명령어에 대한 return을 받은 variable 이 space로 구분된 string 이라면,

아래와 같이 명령어를 배열처럼 구분하여 사용할 수 있다.

string_ex="I am your Father"

str_array=($string_ex)

echo ${str_array[0]} #I

echo ${str_array[1]} #am

echo ${str_array[2]} #you

echo ${str_array[3]} #Father


'Programming > Bash Script' 카테고리의 다른 글

Bash script for statement  (0) 2018.05.21
Bash Script case statement  (0) 2018.02.06
Bash Script Echo  (0) 2018.02.04
Bash Script String  (0) 2017.07.04
Bash Script If statement  (0) 2017.07.04

+ Recent posts