bash 脚本编程十七 NFS client自动部署
1.自动检测并安装nfs-common,
2.自动创建目录并mount
3.同时检查/etc/fstab文件中是否有配置,没有则加入。确保下次开机能自动mount。
install.sh脚本:
#$1 search string#$2 file path#return 1 if found#return 0 if not foundfunction findStringInFile { h=`grep "$1" $2` echo "h: $h" if [ -n "$h" ] thenreturn 1 elsereturn 0 fi}