Prg= "$"while do ls= ' ls-ld ' $PRG "' link= ' expr ' $ls": ' .*-> \ (. *\) $ ' ` if expr "$link": '/.* ' >/dev/null; then PRG= "$link" else C15/>PRG= ' dirname ' $PRG '/' $link ' fidoneprgdir= ' dirname ' $PRG '-Z ' $CATALINA _home "] && catalina_home= ' CD $PRGDIR/:" >/dev/null"Catalina_home is $CATALINA _home";
#此处的RPG抓取的是文件名, because it could be a symbolic link, the function of a looping statement is to find the file's true source path
-H is used to determine if the $prg file exists and is a symbolic link
Ls-ld "$PRG" to view the details of the current directory of the running program, but only the directory, excluding subdirectories and files under the directory
link= ' expr ' $ls ': ' .*-> \ (. *\) $ '
Expr means to match a string to a pattern and return the string to which it is matched
Or calculate the number of characters to match according to a pattern. Commonly used: expr value:expression
The "$ls" represents the contents of the variable ls.
' .*-> \ (. *\) $ ' This part is a regular expression,. * Part denotes any character, and is the actual two characters, the soft link in Linux will use the Ls-al command to list the file, with "soft link-to-real file" way to show the soft link and The actual file to which it is linked. The $ here represents the end of the line \ (that is, because (the shell belongs to a special symbol, you need to use escape; \) is also escaped as);
The entire ' expr ' $ls ': ' .*-> \ (. *\) $ ' means the actual file or the real directory to which the soft connection was taken.
[ -z
"$CATALINA_HOME"
] && CATALINA_HOME=`
cd
"$PRGDIR/.."
>
/dev/null
;
pwd
` 判断变量$CATALINA_HOME是否存在,不存在则给予附值
Shell gets the current path