LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 902|回复: 2

关于shell脚本用mount和gzip的问题,谢谢了!!!请指教!!!

[复制链接]
发表于 2005-5-22 20:43:55 | 显示全部楼层 |阅读模式
  1. #!/bin/bash
  2. mount -o loop -t msdos /home/fydream/makelinux/rhsetup/images/boot.iso /home/fydream/makelinux/mount/bootiso   
  3. gzip -cd /home/fydream/makelinux/mount/bootiso/isolinux/initrd.img > /home/fydream/makelinux/initrd.ext2   
  4. mount -o loop -–t ext2 /home/fydream/makelinux/initrd.ext2 /home/fydream/makelinux/mount/initrdimg
复制代码

我在shell中挨个的用这及格命令都可以的,但是为什么写成脚本运行就这样了?

  1. [root@fydream images]#chmod +x up
  2. [root@fydream images]# ./up
  3. Usage: mount -V                 : print version
  4.        mount -h                 : print this help
  5.        mount                    : list mounted filesystems
  6.        mount -l                 : idem, including volume labels
  7. So far the informational part. Next the mounting.
  8. The command is `mount [-t fstype] something somewhere'.
  9. Details found in /etc/fstab may be omitted.
  10.        mount -a [-t|-O] ...     : mount all stuff from /etc/fstab
  11.        mount device             : mount device at the known place
  12.        mount directory          : mount known device here
  13.        mount -t type dev dir    : ordinary mount command
  14. Note that one does not really mount a device, one mounts
  15. a filesystem (of the given type) found on the device.
  16. One can also mount an already visible directory tree elsewhere:
  17.        mount --bind olddir newdir
  18. or move a subtree:
  19.        mount --move olddir newdir
  20. A device can be given by name, say /dev/hda1 or /dev/cdrom,
  21. or by label, using  -L label  or by uuid, using  -U uuid .
  22. Other options: [-nfFrsvw] [-o options] [-p passwdfd].
  23. For many more details, say  man 8 mount .
  24. gzip: /home/fydream/makelinux/mount/bootiso/isolinux/initrd.img.gz: No such file
  25. or directory
  26. gzip:   .gz: No such file or directory
  27. mount:无效选项 -- ?
  28.                     Usage: mount -V                 : print version
  29.        mount -h                 : print this help
  30.        mount                    : list mounted filesystems
  31.        mount -l                 : idem, including volume labels
  32. So far the informational part. Next the mounting.
  33. The command is `mount [-t fstype] something somewhere'.
  34. Details found in /etc/fstab may be omitted.
  35.        mount -a [-t|-O] ...     : mount all stuff from /etc/fstab
  36.        mount device             : mount device at the known place
  37.        mount directory          : mount known device here
  38.        mount -t type dev dir    : ordinary mount command
  39. Note that one does not really mount a device, one mounts
  40. a filesystem (of the given type) found on the device.
  41. One can also mount an already visible directory tree elsewhere:
  42.        mount --bind olddir newdir
  43. or move a subtree:
  44.        mount --move olddir newdir
  45. A device can be given by name, say /dev/hda1 or /dev/cdrom,
  46. or by label, using  -L label  or by uuid, using  -U uuid .
  47. Other options: [-nfFrsvw] [-o options] [-p passwdfd].
  48. For many more details, say  man 8 mount .
复制代码

请问兄弟们我哪里错了?是不是脚本这么写不对呀?谢谢了!!!
请指教!
发表于 2005-5-23 05:51:52 | 显示全部楼层
#!/bin/bash -xv
用这个debug模式运行,看看能找到什么问题.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-23 09:09:34 | 显示全部楼层
[fydream@fydream images]$ ./up
#!/bin/bash -vx
mount -o loop /home/fydream/makelinux/rhsetup/images/boot.iso /home/fydream/makelinux/mount/bootiso
+ mount -o loop /home/fydream/makelinux/rhsetup/images/boot.iso /home/fydream/makelinux/mount/bootiso $'\343\200\200\343\200\200'
mount: only root can do that
#gzip -cd /home/fydream/makelinux/mount/bootiso/isolinux/initrd.img > /home/fydream/makelinux/initrd.ext2
#mount -o loop -–t ext2 /home/fydream/makelinux/initrd.ext2 /home/fydream/makelinux/mount/initrdimg
出现了这些,但是还是没有挂载上!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表