Skip to content

Instantly share code, notes, and snippets.

@workze
Last active March 18, 2020 03:45
Show Gist options
  • Save workze/fc312df6fad2bb6b7d6b74a25459ebce to your computer and use it in GitHub Desktop.
Save workze/fc312df6fad2bb6b7d6b74a25459ebce to your computer and use it in GitHub Desktop.
linux shell bash script if
#!/usr/bin/env bash
install() {
echo "hi"
}
if [[ "$1" == "install" || "$1" == "start"]];
then $1;
else
echo -e "Uxc";
fi
if [ 条件判断式1 ]
then
当条件判断式1成立时,执行程序1
elif [ 条件判断式2 ]
then
当条件判断式2成立时,执行程序2
...更多判断...
else
当所有条件都不成立时,最后执行此程序
fi
nvidia-container-cli info 2> /dev/null && run_gpu || run_cpu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment