Because there is a definition of all databases in the / var / opt / oracle / ORATAB file,
Cat / var / opt / oracle / oracab
Tesge9i: /u01/app/oracle/product/8.1.7_64: Y
Jiabao9i: /u01/app/oracle/product/8.1.7_64: y
...
It can be seen that the act illustrated is used for the Oracle_sid name before ':'.
CAT / VAR / OPT / ORACLE / ORATAB | GREP -V / # | GREP -V / * | CUT -D ":" -f1
Where grep -v / #, the grep -v / * command ignores every line of comments in the ORATAB file.
Cut -d ":" -f1 command, use the colon as the first column of the ORATAB file as the column