Command:
str3=”$str1 $str2″
The above example command will concatenate values of str1 and str2 stings and store it in third variable str3. Make sure there should not be any space before or after the assignment ( = ) operator.
Example 1:
It is simply write two or more strings variable one after one for concatenating them together.
$ str1="Hello" $ str2="World" $ str3="$str1 $str2" $ echo $str3 >Hello World
Example 2:
It is not required that both string should be variable, We can use one variable and other direct sting to concatenate them.
$ str1="Hello" $ str2="$str1 World" $ echo $str2 >Hello World
Example 3:
We can simply write string variable one after one using $ symbol to concatenate two strings
$ str1="Hello" $ str2="World" $ str3=$str1$str2 $ echo $str3 >HelloWorld
1 Comment
I have the following script that works in AIX but not in red-hst/linux.
/pbin/${8}.ksh $[1} ${2} /pswork/sp.${1}.step120.outfile ${4} ${5} ${6}
1=LX22BILN
2=22
3=BILL
4=22GR
5=22BILL
6=22BILL
7=NONE
8=PR22GRPH
Because the positional position of /pswork/sp.${1}.step120.outfile is 3, it substitues BILL for ${1}
I t should be substituting LX22BILN for ${1}