I was analyzing the script file and I came across the line belowsed -i '/JBOSS_HOME\/bin\/run.sh/i \export TMP_FOLDER=$JBOSS_HOME/server/default/tmp ' /home/jboss/runJBOSSEAP.shI am still not able to figure out what does this command do. I know -i means it is an inline operation. But what it does is still unknown to me. Please help me understand this line.
What does the sed command in the line below do?
sed
sed -i  -i says to edit file in-place, that is write the new version over the same name/JBOSS_HOME\/bin\/run.sh/A pattern, separated by slashes, the slashes contained in the pattern are quoted with backslashes, so this matches any line containing JBOSS_HOME/bin/run.sh. (Actually since it's a regex, the dot matches any character.)i \export TMP_FOLDER=$JBOSS_HOME/server/default/tmp 'Command to run when the pattern matches, i is for inserting a line (before the current). The line to be added is separated by the backslash, so this adds the string export TMP_FOLDER=$JBOSS_HOME/server/default/tmp./home/jboss/runJBOSSEAP.shTarget file name.e.g.$ echo JBOSS_HOME/bin/run.sh > pla $ sed -i '/JBOSS_HOME\/bin\/run.sh/i \export TMP_FOLDER=$JBOSS_HOME/server/default/tmp ' pla$ cat plaexport TMP_FOLDER=$JBOSS_HOME/server/default/tmp JBOSS_HOME/bin/run.shIt's pretty much the same as e.g. the example here