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 ...
随机推荐
- CentOS7 开机调整亮度
默认亮度是100,受不了,所与就自己想了个办法,依赖其它的自启动服务使我的设置生效. /usr/lib/systemd/scripts/nfs-utils_env.sh这是一个开机自启动服务要用到的脚 ...
- oracle 11g安装过程中问题:找不到WFMLRSVCApp.ear
网上的方法是将两个压缩包解压到同一个目录中,我的方法是不再此解压,麻烦,直接将解压出的内容剪切过去,方便省事,原理也是相同的. 解决方法: 将win64_11gR2_database_2of2解压 ...
- union和union all 合并查询
union联合查询 SELECT TOP ID,oTitle Title,oInfo Description,Pic Images AND UpTime > dateadd(day,-,UpTi ...
- Java小知识--length,length(),size()方法详细介绍
Java中length,length(),size()区别 length属性:用于获取数组长度. eg: int ar[] = new int{1,2,3} /** * 数组用length属性取得长度 ...
- oracle数据库创建后要做的事情
在SQL Plus工具中(oracle自带)用conn /as sysdba登录数据库. 一:先新建用户 create user test01 identified by test02(test01为 ...
- AgileEAS.NET SOA 中间件平台5.2版本下载、配置学习(四):开源的Silverlight运行容器的编译、配置
一.前言 AgileEAS.NET SOA 中间件平台是一款基于基于敏捷并行开发思想和Microsoft .Net构件(组件)开发技术而构建的一个快速开发应用平台.用于帮助中小型软件企业建立一条适合市 ...
- 【leetcode】Max Points on a Line
Max Points on a Line 题目描述: Given n points on a 2D plane, find the maximum number of points that lie ...
- if else 的妙用 —— 顾客视角
if (storedCash % 100 != 0) { System.out.println("请输入100的倍数!!!"); } else if(storedCash % 10 ...
- BurpSuite设置公共WIFI抓包
1.电脑连接公共WIFI
- MemCache
MemCache是一个自由.源码开放.高性能.分布式的分布式内存对象缓存系统,用于动态Web应用以减轻数据库的负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高了网站访问的速度.Mem ...