【问题标题】:How to make a bash script to run fakeroot and exit from fakeroot?如何制作一个 bash 脚本来运行 fakeroot 并退出 fakeroot?
【发布时间】:2020-03-31 17:26:54
【问题描述】:

我有以下 bash 脚本,我想进入 fakeroot 环境,然后运行其他命令,然后退出,我可以运行我的笔记本电脑 ubuntu 终端。

$ cat test_root.sh
#!/bin/bash
set -u
set -e
fakeroot
echo "my $UID"
exit

但该脚本不起作用,感谢您提供修复它的线索。

$ ./test_root.sh
root\#
root\# exit
exit
my 1000

谢谢。

亲切的问候,

【问题讨论】:

    标签: linux bash


    【解决方案1】:

    来自man fakerootfakeroot -- command

    $ fakeroot sh -c 'echo "my $UID"'
    my 0
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-08
      • 1970-01-01
      • 2022-01-26
      • 2023-01-16
      • 2014-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多