要显示创建虚拟软盘映像文件作为超级用户或用户可以运行sudo命令,有很多帖子.基本步骤是:
dd命令创建空的1.44MB图像文件mkfs.msdosumount 虚拟软盘映像文件我的问题是,如果我只是一个无法运行sudo命令的普通用户,我如何按照上述步骤创建虚拟软盘映像并在其中写入内容?
非常感谢.
命令pstree PID可以显示由指定的进程的所有子进程信息PID.但是,我也想了解该过程的所有父进程信息,PID我该如何获得它?
举个例子,给出以下过程:
init |- parent_process | `- current_process | |- subprocess_1 | `- subprocess_2 `- other_process
我想要的是当我跑步时pstree current_process_pid,我想要低于输出
init
`- parent_process
`- current_process
|- subprocess_1
`- subprocess_2
当我跑pstree subprocess_1_pid,它会输出
init
`- parent_process
`- current_process
`- subprocess_1
提前致谢
是否doctest支持输出和异常混合在一起?
一个例子是:
>>> def foo():
... print 'hello world!'
>>> foo()
hello world!
>>> def bar():
... raise Exception()
>>> bar()
Traceback (most recent call last):
...
Exception
>>> def foo_bar():
... foo()
... bar()
>>> foo_bar()
hello world!
Traceback (most recent call last):
...
Exception
Run Code Online (Sandbox Code Playgroud)
我预计这三个案例都会成功,但只有其中两个成功,请参阅
$ python -m doctest -v /tmp/1.py
Trying:
def foo():
print 'hello world!'
Expecting nothing
ok
Trying:
foo()
Expecting:
hello world!
ok
Trying:
def bar():
raise Exception()
Expecting nothing
ok
Trying:
bar() …Run Code Online (Sandbox Code Playgroud)