# 🔍 Description
## Issue References 🔗
This pull request fixes#5987
Modify the logic in the beeline script that specifies the KYUUBI_HOME environment variable.
## Describe Your Solution 🔧
If the environment has already declared KYUUBI_HOME, it should use the pre-declared KYUUBI_HOME instead of forcefully specifying the parent directory of the current one.
## Types of changes 🔖
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
## Test Plan 🧪
#### Behavior Without This Pull Request ⚰️
1. set soft link:
`ln -s /opt/soft/kyuubi/kyuubi/bin/beeline /usr/bin/kyuubi-beeline`
2. set env like:
`export KYUUBI_HOME=/opt/soft/kyuubi/kyuubi`
3. run kyuubi-beeline:
`kyuubi-beeline -u "jdbc:hive2://xx.xx.xx.xx:2181,xx.xx.xx.xx:2181,xx.xx.xx.xx:2181/tmp;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=kyuubi;principal=hive/_HOSTxxx"`
4. command will fail:
`/bin/kyuubi-beeline: line 27: //bin/load-kyuubi-env.sh: No such file or directory
Error: JAVA_HOME IS NOT SET! CANNOT PROCEED.`
#### Behavior With This Pull Request 🎉
1. set soft link:
`ln -s /opt/soft/kyuubi/kyuubi/bin/beeline /usr/bin/kyuubi-beeline`
2. set env like:
`export KYUUBI_HOME=/opt/soft/kyuubi/kyuubi`
3. run kyuubi-beeline:
`kyuubi-beeline -u "jdbc:hive2://xx.xx.xx.xx:2181,xx.xx.xx.xx:2181,xx.xx.xx.xx:2181/tmp;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=kyuubi;principal=hive/_HOSTxxx"`
4. command will success
#### Related Unit Tests
---
# Checklist 📝
- [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)
**Be nice. Be informative.**
Closes#5988 from Emor-nj/kyuubi-beeline.
Closes#5987
3a988e0f7 [Emor-nj] fix KYUUBI_HOME is always empty in load-kyuubi-env.sh
cc703870f [Emor-nj] fix load-kyuubi-env.sh
a10142825 [Emor-nj] Remove unnecessary exports.
f48db3f81 [Emor-nj] uniformly modify all related scripts.
35215b978 [Emor-nj] Modify the logic in the beeline script that specifies the KYUUBI_HOME environment variable.
Authored-by: Emor-nj <emor93@foxmail.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>