Home > Backend Development > PHP Tutorial > 一个简单shell,不按套路来,哪位高手帮看一下

一个简单shell,不按套路来,哪位高手帮看一下

WBOY
Release: 2016-06-13 13:49:17
Original
881 people have browsed it

一个简单shell,不按套路来,谁帮看一下

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->#!/bin/bash

exeuser=worker
userid=`id -nu`
if [ "$userid"!="$exeuser" ];then
    echo "only user:worker can execuce"
    exit;
fi
Copy after login


一个脚本,有时忘了,用root就执行了,所以脚本加了一个判断 ,可不知道为什么,if总返回真

------解决方案--------------------
用worker用户执行就不会返回true,我试过了, linux as4 。。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template