以su命令运行bash函数
发布时间:2020-12-16 01:30:43 所属栏目:安全 来源:网络整理
导读:在我的bash脚本中,我执行一些命令作为其他用户. 我想在之前的脚本中定义的su命令中调用一个bash函数. my_function(){ do_something}su username -c "my_function" 上面的脚本不起作用,当然在su中没有定义my_function. 我只想到将功能保存到单独的文件中.任何
在我的bash脚本中,我执行一些命令作为其他用户.
我想在之前的脚本中定义的su命令中调用一个bash函数. my_function() { do_something } su username -c "my_function" 上面的脚本不起作用,当然在su中没有定义my_function.
您可以导出函数使其可用于subshel??l:
export -f my_function su username -c "my_function" (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Bootstrap-Table实现从服务器加载数据进行显示
- angularjs – AngularUI datepicker-popup – 手动输入日期
- angularjs – 选择bootstrap和材料设计
- angularjs – Bootstrap-UI Typeahead在结果列表中显示多个
- 如何将一行分割成由一个或多个空格分隔的bash?
- 在angular2中使用app.component.html中的* ngIf更改路由器插
- 没有AngularFireDatabase的提供者,AngularFireAuth
- 求解:wince 程序在模拟器上运行正常,布到PDA上调不通webs
- Scala更高的kinded类型方差
- webservice