會員 | 寫了一個script搞不懂,為什麼不行?【求助】 原始碼如下 #!/bin/bash echo "Please keyin your account" read account echo "Please keyin your password" read password echo "Please keyin remote path" read sadd echo "Please keyin local mount point" read dadd echo $account echo $password echo $sadd echo $dadd all="mount -t smbfs -o username="$account",password="$password" -o rw -o iocharset=big5 -o codepage=950 "$sadd" "$dadd"" echo $all mount -t smbfs -o username="$account",password="$password" -o rw -o iocharset=big5 -o codepage=950 "$sadd" "$dadd" 執行過程及結果如下 [root@mdk90 mnt]# sh go1.sh Please keyin your account ericshei Please keyin your password abcde Please keyin remote path "//piii-1g/ftp (F)" Please keyin local mount point /mnt/home/40g ericshei abcde "//piii-1g/ftp (F)" /mnt/home/40g mount -t smbfs -o username=ericshei,password=abcde -o rw -o iocharset=big5 -o codepage=950 "//piii-1g/ftp (F)" /mnt/home/40g --->變數$all的內容 Usage: mount.smbfs service mountpoint [-o options,...] Version 2.2.6pre2 Options: username= SMB username password= SMB password credentials= file with username/password netbiosname= source NetBIOS name uid= mount uid or username gid= mount gid or groupname port= remote SMB port number fmask= file umask dmask= directory umask debug= debug level ip= destination host or IP address workgroup= workgroup on destination sockopt= TCP socket options scope= NetBIOS scope iocharset= Linux charset (iso8859-1, utf8) codepage= server codepage (cp850) ttl= dircache time to live guest don't prompt for a password ro mount read-only rw mount read-write This command is designed to be run from within /bin/mount by giving the option '-t smbfs'. For example: mount -t smbfs -o username=tridge,password=foobar //fjall/test /data/test [root@mdk90 mnt]# mount -t smbfs -o username=ericshei,password=abcde -o rw -o iocharset=big5 -o codepage=950 "//piii-1g/ftp (F)" /mnt/home/40g--->貼上變數$all的內容執行就接收 [root@mdk90 mnt]# cd home/ [root@mdk90 home]# cd .. [root@mdk90 mnt]# cd home/40g/ [root@mdk90 40g]# ls albums/ FTP/ _NIM4711.TMP* RECYCLER/ Rich6/ System Volume Information/ video/ WUTemp/ [root@mdk90 40g]# df -h 檔案系統 容量 已用 可用 已用% 掛載點 /dev/hda5 945M 86M 812M 10% / /dev/hda1 15M 3.0M 11M 23% /boot /dev/hda9 1.1G 251M 789M 25% /home /dev/hda10 387M 9.0M 358M 3% /tmp /dev/hda7 2.9G 2.0G 827M 71% /usr /dev/hda8 1018M 132M 835M 14% /var //piii-1g/ftp_(G) 75G 30G 45G 40% /mnt/home/80g //piii-1g/ftp_(F) 38G 30G 7.7G 80% /mnt/home/40g 成功的mount 起來 Why?? |
回覆 |
XML | RSS 2.0 | RSS |
本論壇所有文章僅代表留言者個人意見,並不代表本站之立場,討論區以「即時留言」方式運作,故無法完全監察所有即時留言,若您發現文章可能有異議,請 email :[email protected] 處理。