使用SCRIPT交互式启动Rdesktop

Rdesktop 是一个很好的软件,可以让我们在 Linux X Window 环境下轻松的连接到微软 Windows 标准的远程桌面。
但是 Rdesktop 这个软件启动时需要同时指定一些参数来调整和优化远程桌面的窗口,输入这些参数是否有些麻烦呢( 其实也不很麻烦,只是为了下面的 Script 程序才这么说的,呵呵,也许初学者会觉得吧 ^_^ ),那么就看看下面这支 Bash Shell Script 程序,通过这个程序来启动 Rdesktop 会直观一些。
另外,把这支文件通过 GUI 界面建立快捷方式(符号连接)启动比在 CLI 启动更好些。
下面看看 Script 内容吧:
 
#!/bin/bash
#Program:
#    This program is run Rdesktop.
#History:
# 2008/1/15 Roland   First release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
 
ip=""
us=""
pw=""
yn=""
pa="/home/roland/softs/rdesk/bin/rdesktop"
#rdesktop 执行文件的路径改成自己系统的实际路径
 
read -p "Please input Server IP address: " ip
# 输入远程服务器的 IP 地址
while [ "$ip" == "" ]
do
      ip=""
      read -p "You input the Server IP address error, please agin input: " ip
done
# 判断 IP 是否为空
read -p "Please input USERNAME: " us
# 读取并判断是否输入了用户名
if [ "$us" != "" ]; then
      read -p "Please input PASSWORD: " pw
      # 读取并判断是否输入了密码
      if [ "$pw" != "" ]; then
           read -p "If Full Screen please input "y" or "Y",input other unFull Screen: " yn
           # 判断是否全屏显示
           if [ "$yn" == "y" ] || [ "$yn" == "Y" ]; then
                 $pa "$ip" -u "$us" -p "$pw" -f -r clipboard:PRIMARYCLIPBOARD
           else
                 $pa "$ip" -u "$us" -p "$pw" -r clipboard:PRIMARYCLIPBOARD
           fi         
      else
           read -p "If Full Screen please input "y" or "Y",input other unFull Screen: " yn
           if [ "$yn" == "y" ] || [ "$yn" == "Y" ]; then
                 $pa "$ip" -u "$us" -f -r clipboard:PRIMARYCLIPBOARD
           else
                 $pa "$ip" -u "$us" -r clipboard:PRIMARYCLIPBOARD
           fi
      fi
else
      read -p "If Full Screen please input "y" or "Y",input other unFull Screen: " yn
      # 判断是否全屏显示
      if [ "$yn" == "y" ] || [ "$yn" == "Y" ]; then
           $pa "$ip" -f -r clipboard:PRIMARYCLIPBOARD
      else
           $pa "$ip" -r clipboard:PRIMARYCLIPBOARD
      fi
fi
 
exit 0
 

你可能感兴趣的:(启动,script,休闲,rDesktop,交互式)