zhyiwww
          用平實(shí)的筆,記錄編程路上的點(diǎn)點(diǎn)滴滴………
          posts - 536,comments - 394,trackbacks - 0
          錯(cuò)誤現(xiàn)象:
          deployer@andy-VirtualBox:~/pds/EB$ sh build.sh
          build.sh: 18: build.sh: declare: not found

          build.sh: 25: build.sh: declare: not found

          build.sh: 32: build.sh: declare: not found

          原因分析:
          root@andy-VirtualBox:/home/deployer/pds/EB# file /bin/sh
          /bin/sh: symbolic link to `dash'
          root@andy-VirtualBox:/home/deployer/pds/EB# file /bin/dash
          /bin/dash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x5d23ca7cbab4993f295d1089b4860eb32d406fab, stripped
          root@andy-VirtualBox:/home/deployer/pds/EB# file /bin/bash
          /bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xf199a4a89ac968c2e0e99f2410600b9d7e995187, stripped
          root@andy-VirtualBox:/home/deployer/pds/EB# ln -s /bin/bash /bin/sh
          ln: failed to create symbolic link `/bin/sh': File exists
          root@andy-VirtualBox:/home/deployer/pds/EB# ln -s /bin/bash /bin/sh -f
          root@andy-VirtualBox:/home/deployer/pds/EB# file /bin/sh
          /bin/sh: symbolic link to `/bin/bash'
          重點(diǎn)看紅色字體部分,可以看到,初始是/bin/sh是到/bin/dash的鏈接。修改后為到/bih/bash的鏈接。
          所以,問題出在,我們的腳本是bash的腳本。而用dash去執(zhí)行。雖然dash和bash都是shell,在執(zhí)行時(shí)還是有差別的。
          解決方法:
          (1)執(zhí)行時(shí)由sh build.sh變成bash build.sh可以解決此問題。
          (2)ln -s /bin/bash /bin/sh -f
          (3)sudo dpkg-reconfigure dash 進(jìn)行配置,道理同(2)
          歸結(jié)來說,為兩種方式。以上兩種方法都可以實(shí)現(xiàn)。

          感謝http://blog.sina.com.cn/s/blog_7cb1c50e0100rapz.html博主。





          |----------------------------------------------------------------------------------------|
                                     版權(quán)聲明  版權(quán)所有 @zhyiwww
                      引用請注明來源 http://www.aygfsteel.com/zhyiwww   
          |----------------------------------------------------------------------------------------|
          posted on 2012-07-19 16:01 zhyiwww 閱讀(6572) 評論(0)  編輯  收藏 所屬分類: linux
          主站蜘蛛池模板: 新疆| 临湘市| 天柱县| 江阴市| 西藏| 大足县| 图木舒克市| 鄱阳县| 宜城市| 石城县| 天全县| 犍为县| 淮滨县| 汝南县| 英德市| 松阳县| 柳河县| 榆林市| 织金县| 滨海县| 涞源县| 宣威市| 永修县| 西青区| 建始县| 普陀区| 巴林左旗| 广水市| 镇雄县| 克什克腾旗| 贵溪市| 泗水县| 中卫市| 凌海市| 安化县| 景洪市| 雷波县| 龙陵县| 张家界市| 上林县| 武汉市|