shell相关的面试题

CentOS Linux系统默认的shell是()

解答:bash
查看方法:

1
2
3
4
5
> [root@centos-7.3 ~]# echo $SHELL
> /bin/bash
> [root@centos-7.3 ~]# awk -F ':' '/^root/{print $NF}' /etc/passwd
> /bin/bash
>

已知如下命令及返回结果,请问echo $user的返回结果是()

1
2
3
4
5
6
7
8
> [root@test ~]# cat test.sh 
> #!/bin/bash
> user=`whoami`
> [root@test ~]# sh test.sh
>
> [root@test ~]# echo $user
> ???
>
有钱任性,请我吃包辣条
0%