相关疑难解决方法(0)

为什么要在Bash中避免使用eval,我应该使用什么呢?

我一次又一次地看到Bash在Stack Overflow上使用eval的答案,并且答案得到了抨击,双关语是为了使用这种"邪恶"结构.为什么eval这么邪恶?

如果eval不能安全使用,我应该使用什么呢?

unix linux bash eval

94
推荐指数
3
解决办法
6万
查看次数

执行带超时的shell函数

为什么会这样呢?

timeout 10s echo "foo bar" # foo bar
Run Code Online (Sandbox Code Playgroud)

但这不会

function echoFooBar {
  echo "foo bar"
}

echoFooBar # foo bar

timeout 10s echoFooBar # timeout: failed to run command `echoFooBar': No such file or directory
Run Code Online (Sandbox Code Playgroud)

我怎样才能让它发挥作用?

bash shell timeout function

57
推荐指数
6
解决办法
7万
查看次数

是否可以在OpenWRT中安装超时

我需要在OpenWRT中执行带超时的命令,但似乎默认情况下没有安装命令超时,也不能使用opkg安装.我知道我可以做一个工作(使用命令&; sleep $ DELAY; kill $!),但我希望更好地做到这一点,而不会在超时之前命令完成时尝试杀死进程的冒险.

timeout openwrt

2
推荐指数
1
解决办法
1481
查看次数

标签 统计

bash ×2

timeout ×2

eval ×1

function ×1

linux ×1

openwrt ×1

shell ×1

unix ×1