💡 参考文章见Ref,感谢提供思路! 🗺️当前这篇博文地址:https://myoontyee.github.io/article/54e1736e.html ⚠️警告:博客文章禁止一切形式的非授权非法转载! ⚠️Attention: All forms of unauthorized illegal reposts are prohibited !
创建时间:2022年4月10日10:11:38 最新更新:2022年4月10日11:43:55
Problem Description:WSL, WSL2 has multiple environment variables that you want to source, how to interactively select them based on if-else in .bashrc and then in bash? instead of using complex instructions every time
# 选择你需要的环境变量 echo"==================================================" echo"Please input the environment you want to choose :" echo"1. Default: WSL + Python with Jupyter" echo"2. Geant4" echo"3. ROOT" echo"==================================================" echo"The environment number you want to choose is :" read envType
echo"==================================================" echo"Processing ..." echo"==================================================" echo"The environment you choose is :" if ((envType == 1)); then echo"1. default: WSL + Python with Jupyter"
elif ((envType == 2)); then echo"2. Geant4" source 改成你自己的Geant4安装路径,记得有mnt/install/bin/geant4.sh echo"The path is : 改成你自己的Geant4安装路径,记得有mnt/install/bin/geant4.sh" elif ((envType == 3)); then echo"3. ROOT" source 改成你自己的ROOT安装路径,记得有mnt/bin/thisroot.sh echo"The path is : 改成你自己的ROOT安装路径,记得有mnt/bin/thisroot.sh" else echo"Type Error !" fi