shell (check return of each line)and sudoer
shell result from cmdline
echo $?
if 0 then success ;else failure
(shell 执行每部返回值,rm -rf 错误,打包不能覆盖)
have a tty to run sudo
sorry, you must have a tty to run sudo,后来,在网上了解到可以如下解决:
requiretty,修改为 #Defaults requiretty,表示不需要控制终端。
requiretty,修改为 Defaults:nobody !requiretty,表示仅 nobody 用户不需要控制终端。
Defaults:%nobody !requiretty,表示仅 nobody 组不需要控制终端。
requiretty
那个就可以了。表示在执行的时候不打开终端。但是,有的shell必须要有终端才可以执行。这样显然是不行的。后来,又找到一片文章才搞定。下面为抄录的,仅为记录以后使用。
但可能这个程序需要控制终端, 这这么办呢?
可是中间有个程序(旧的systemtap)使用了sudo
但这样很对用户不友好啊)
a tty to run sudo
那就是你的系统的sudo配置文件允许sudo可以在这个,
requiretty)
`/dev/tty' for reading: No such device or address
所以应该使用能创建(伪)控制终端的程序来启动你的程序如: script, expect
ls" /dev/null
sudo ls; expect'
0 /dev/tty' /dev/null
head -c 0 /dev/tty; expect'
组合使用有着奇怪的bug, 我这段时间非常的depression,
都是大材小用了
shell (check return of each line)and sudoer的更多相关文章
- shell (check return of each line)(PIPESTATUS[@])and sudoer
shell result from cmdline echo $? if 0 then success ;else failure (shell 执行每部返回值,rm -rf 错误,打包不能覆盖) 我 ...
- Shell脚本:while read line无法读取最后一行的问题
[1]Shell脚本:while read line无法读取最后一行的问题 刚刚利用shell脚本处理日志文件时,发现了一个问题:while read line无法读取到最后一行 通过编辑器可以看到待 ...
- SAP(ABAP):STOP,EXIT,CHECK,RETURN,REJECT,CONTINUE
Stop 命令使用该命令的程序位置INITIALIZATION, AT SELECTION-SCREEN, START-OF-SELECTION和GET 事件中处理说明1. 当在INITIALIZAT ...
- learning shell check requires root privileges
[Purpose] Shell script check requires root privileges [Eevironment] Ubuntu 16.04 bas ...
- learning shell check host dependent pkg
[Purpose] Shell script check host dependent pkg [Eevironment] Ubuntu 16.04 bash env ...
- Shell check IP
#! /bin/bash checkip() { if echo $1 |egrep -q '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3 ...
- 如何在Windows下开发Python:在cmd下运行Python脚本+如何使用Python Shell(command line模式和GUI模式)+如何使用Python IDE
http://www.crifan.com/how_to_do_python_development_under_windows_environment/ 本文目的 希望对于,如何在Windows下, ...
- KoaHub.JS用于Node.js的可移植Unix shell命令程序代码
shelljs Portable Unix shell commands for Node.js ShellJS - Unix shell commands for Node.js Shell ...
- shell脚本小案例
1.获取远程ftp数据到本地目录 #!/bin/bash ftp -n<<! open 135.0.24.19 user exchange exchange binary cd /idep ...
随机推荐
- Frame创建窗体实例
public class Test { public static void main(String[] args) { // TODO Auto-generated method stub Fram ...
- %u编码
Escape/Unescape加密解码/编码解码,又叫%u编码,从以往经验看编码字符串出现有"u",它是unicode编码,那么Escape编码采用是那一种unicode实现形式呢 ...
- iOS中滤镜处理及相关内存泄漏问题的解决
最近工作之余在做一个美图秀秀的仿品 做到滤镜这块的时候 自己就参考了网上几位博主(名字忘了记,非常抱歉)的博客,但是发现跟着他们的demo做的滤镜处理,都会有很严重的内存泄漏,于是就自己按照大体的思 ...
- C#向Sql数据库插入控制
string name = textBox1.Text; int age = Convert.ToInt32(textBox2.Text.Trim()); ? null : (int?)Convert ...
- 【转载】 删除Win10“这台电脑”中的6个文件夹
转载地址:http://www.myxzy.com/post-431.html Windows 8.1/windows 10对比windows 7都有一个变化,打开“这台电脑”(或“我的电脑”)后,“ ...
- Android实战技巧之十二:Android Studio导入第三方类库、jar包和so库
第三方类库源码 将一网友的XMPP代码从ADT转到AS时,发现其使用了第三方类库,源码放在了lib下,直接在AS中Import project,第三方类库并没有自动导入进来,看来需要自己动手了. 项目 ...
- ASP.NET常见面试题及答案(130题)
1.C#中 property 与 attribute(抽像类)的区别,他们各有什么用处,这种机制的好处在哪里?答:property和attribute汉语都称之为属性.不过property是指类向外提 ...
- CS: Marshalling and Unmarshalling, Serialization and Unserialization
Link1: https://en.wikipedia.org/wiki/Marshalling_(computer_science) Quote: " Comparison with se ...
- HDU5942 : Just a Math Problem
\[\begin{eqnarray*}ans&=&\sum_{i=1}^ng(i)\\&=&\sum_{i=1}^n\sum_{d|i}\mu^2(d)\\&= ...
- Leetcode Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum lengt ...