小编All*_*exj的帖子

为什么我无法为“其他”设置 setuid?

我无法设置其他人的 setuid 位。为什么?有安全锁吗?

$ ls -l                                                                              
-rwxrwxr-x  1 allexj allexj 16784 Mar 11 17:30 a.out                                                                                                       
$ chmod o=+s a.out                                                              
$ ls -l                                                                              
-rwxrwx---  1 allexj allexj 16784 Mar 11 17:30 a.out
Run Code Online (Sandbox Code Playgroud)

bash setuid permissions chmod setgid

2
推荐指数
1
解决办法
639
查看次数

如何在 sed 中“优先考虑”某些模式而不是其他模式?

我有这个 sed 过滤器:

/.*[1-9][0-9][0-9] .*/{
        s/.*\([1-9][0-9][0-9] .*\)/\1/
}

/.*[1-9][0-9] .*/{
        s/.*\([1-9][0-9] .*\)/\1/
}

/.*[0-9] .*/{    # but this is always preferred/executed
        s/.*\([0-9] .*\)/\1/
}
Run Code Online (Sandbox Code Playgroud)

问题是前两个限制性更强,并且它们没有被执行,因为最后第三个更“强大”,因为它包括前两个。有没有办法让 sed 采取前两个,并带有“优先顺序”?喜欢

if the first matches
    do first things
elif the second matches
    do second things
elif the third matches
    do third things
Run Code Online (Sandbox Code Playgroud)

sed regular-expression

1
推荐指数
1
解决办法
957
查看次数

标签 统计

bash ×1

chmod ×1

permissions ×1

regular-expression ×1

sed ×1

setgid ×1

setuid ×1