小编lay*_*yka的帖子

sudo 将使用哪个 shell 来执行没有 shebang 行的 shell 脚本

我的环境是Ubuntu 12.04 LTS,sudo版本是1.8.3p1。

首先我以普通用户身份登录:

$ whoami
fin

$ cat /etc/passwd | grep -i "root\|fin"
root:x:0:0:root:/root:/bin/bash
fin:x:1000:1000:This is a normal user:/home/fin:/bin/bash

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Mar 30  2012 /bin/sh -> dash

$ ls -l /bin/bash
-rwxr-xr-x 1 root root 920788 Apr  3  2012 /bin/bash

$ echo $SHELL
/bin/bash

$ ps | grep "$$" | awk '{ print $4 }'
bash

$ ls -l ./test.sh
-rwxr-xr-x 1 fin fin 37 Sep 27 16:46 test.sh

$ …
Run Code Online (Sandbox Code Playgroud)

shell bash sudo shell-script

7
推荐指数
2
解决办法
2709
查看次数

标签 统计

bash ×1

shell ×1

shell-script ×1

sudo ×1