vncpasswd
#!/bin/bash pw=123456 function vncpw(){ /usr/bin/expect <<eof set timeout 10 spawn vncpasswd expect "Password:" send "$pw\n" expect "Verify:" send "$pw\n" expect "password (y/n)?" send "n\n" expect eof eof } function tigerserver(){ rpm -q tigervnc-server >/dev/null 2>&1 if [ $? -ne 0 ] then yum install -y tigervnc* >/dev/null 2>&1 vncpw x0vncserver PasswordFile=/root/.vnc/passwd AlwaysShared=0 AcceptPointerEvents=0 AcceptKeyEvents=0 else echo "tigervnc already install..." echo -n "Please input your vnc connect " vncpw x0vncserver PasswordFile=/root/.vnc/passwd AlwaysShared=0 AcceptPointerEvents=0 AcceptKeyEvents=0 fi } main(){ tigerserver } main