相关疑难解决方法(0)

将参数传递给 su 提供的 shell

man su 说:

You can use the -- argument to separate su options from the arguments
supplied to the shell.
Run Code Online (Sandbox Code Playgroud)

man bash 说:

--        A  --  signals  the  end of options and disables further option
          processing.  Any arguments after the -- are treated as filenames
          and arguments.  An argument of - is equivalent to --.
Run Code Online (Sandbox Code Playgroud)

那么,让我们看看:

[root ~] su - yuri -c 'echo "$*"' -- 1 2 3
2 3
[root ~] su - yuri -c 'echo "$*"' -- -- …
Run Code Online (Sandbox Code Playgroud)

shell bash su options

8
推荐指数
2
解决办法
8864
查看次数

标签 统计

bash ×1

options ×1

shell ×1

su ×1