首页 > 代码库 > 1. Bash 介绍

1. Bash 介绍

你可以通过 $cat /etc/shells 来查看当前系统支持哪些shell类型。

[root@localhost log]# cat /etc/shells /bin/sh/bin/bash/sbin/nologin/bin/dash

 

你默认的shell类型在/etc/passwd文件下

eye:x:500:500::/home/eye:/bin/bash

 

Bash是一个GNU Shell, 当它启动时,会去读他的启动配置文件

  • /etc/profile
  • ~/.bash_profile
  • ~/.bashrc

 

Shell 第一个案例

#!/bin/bashclearecho "The script starts now."echo "Hi, $USER"echoecho "I will now fetch you a list of connected suers:"echo wechoecho "I‘m setting two variables now."COLOUR="black"VALUE="9"echo "This is a string: $COLOUR"echo "And this is a number: $VALUE"echoecho "I‘m giving you back your prompt now."echo

 

1. Bash 介绍