LinuxSir.cn,穿越时空的Linuxsir!

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

命令行的使用

[复制链接]
发表于 2007-1-19 09:16:15 | 显示全部楼层 |阅读模式
苹果系统有着完美的图形界面和在此基础上的各种应用程序,尽管如此,对于习惯linux&unix的使用者来说,命令行有着不可替代的作用。
MacOSX带有众多的shell:

  1. chg@Darwin ~$ ll /bin/*sh
  2. -rwxr-xr-x   1 root  wheel    568K  4 25  2006 /bin/bash
  3. -r-xr-xr-x   2 root  wheel    338K  3 21  2005 /bin/csh
  4. -r-xr-xr-x   1 root  wheel    875K  3 21  2005 /bin/ksh
  5. -r-xr-xr-x   1 root  wheel    568K  4 25  2006 /bin/sh
  6. -r-xr-xr-x   2 root  wheel    338K  3 21  2005 /bin/tcsh
  7. -rwxr-xr-x   2 root  wheel    479K  3 21  2005 /bin/zsh
复制代码

其中,bash是默认shell。
它的配置文件是~/.profile,这一点和现在主流的linux有些不同(linux下为~/.bashrc)。在这个文件中可以设置各种环境变量。

MacOSX带有众多的命令行工具和完整的man文档,使用和linux下基本一致!
发表于 2007-1-19 18:00:45 | 显示全部楼层
~/.bashrc也起作用的,这个无论OSX还是Linux都是一样的。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-1-21 18:46:48 | 显示全部楼层
多谢指正!我再试试我的.bashrc。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-1-21 19:37:54 | 显示全部楼层
刚才测试了一下,同样的内容,mv .profile .bashrc后,连alias都不起作用了!
看了一下man文档,

  1. ... ...
  2.        When  bash is invoked as an interactive login shell, or as a non-inter-
  3.        active shell with the --login option, it first reads and executes  com-
  4.        mands  from  the file /etc/profile, if that file exists.  After reading
  5.        that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
  6.        in  that order, and reads and executes commands from the first one that
  7.        exists and is readable.  The --noprofile option may be  used  when  the
  8.        shell is started to inhibit this behavior.

  9.        When  a  login  shell  exits, bash reads and executes commands from the
  10.        file ~/.bash_logout, if it exists.

  11.        When an interactive shell that is not a login shell  is  started,  bash
  12.        reads  and executes commands from ~/.bashrc, if that file exists.  This
  13.        may be inhibited by using the --norc option.  The --rcfile file  option
  14.        will  force  bash  to  read  and  execute commands from file instead of
  15.        ~/.bashrc.
  16. ... ...
复制代码
回复 支持 反对

使用道具 举报

发表于 2007-1-21 19:49:05 | 显示全部楼层
其实这和其他UNIX类系统上运行的bash没什么区别。
回复 支持 反对

使用道具 举报

发表于 2007-1-21 22:01:49 | 显示全部楼层
bash 就是 bash, 没什么不一样吧

对了,有个东西想不明白 前几天试过, 在 mac 下, 让 ls 带颜色用的是 -G 选项(好象是), 而在 linux/fc 下是 --color 选项, 为什么他们要搞的不一样呢? 统一一下多好
回复 支持 反对

使用道具 举报

发表于 2007-1-22 16:29:47 | 显示全部楼层
这个是BSD和GNU选项风格的区别...
很多*BSD utilities都只支持单字符选项,并且严格限制选项的位置。
回复 支持 反对

使用道具 举报

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

本版积分规则

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