functionprintHelp(){ echo"Usage: . switchFoam VERSION [OPTIONS]" echo"Options: " echo" -help Shows this help" echo" -version <version> Switches to the version explicitly" echo" Available versions:" forkeyin${!AVAILABLE_VERSION[*]};do echo" "$key done }
# checks current version if[$to_version=$WM_PROJECT_VERSION];then echo"OpenFOAM version is alredy "$WM_PROJECT_VERSION"." return fi
# switches version bashrc_path=${AVAILABLE_VERSION[$to_version]} if[-n"$bashrc_path"];then source$bashrc_path echo"OpenFOAM version is switched to "$WM_PROJECT_VERSION"." else echo$to_version" is Unknown version." fi
$. switchFoamVersion -help
Usage: . switchFoam VERSION [OPTIONS]
Options:
-help Shows this help
-version Switches to the version explicitly
Available versions:
4.1
v1706
$. switchFoamVersion v1706
OpenFOAM version is switched to v1706.
$. switchFoamVersion
OpenFOAM version is switched to 4.1.
$. switchFoamVersion 4.1
OpenFOAM version is alredy 4.1.