ShellScript(8) - String

 

String (문자열)에 관한 내용입니다.


예제.1 - Combine String variables

1
2
3
4
5
6
7
8
#!/bin/bash

string1="Linux"
string2="Hint"
    echo "$string1$string2"
string3=$string1+$string2
string3+=" is a good tutorial blog site"
    echo $string3
LinuxHint
Linux+Hint is a good tutorial blog site


예제.2 - Get substring of String

1
2
3
4
#!/bin/bash
Str="Learn Linux from LinuxHint"
subStr=${Str:6:5}
    echo $subStr
Linux