相关疑难解决方法(0)

有没有办法从管道执行本机二进制文件?

echo 'main(){}' | gcc -xc - -o /dev/stdout | ???
Run Code Online (Sandbox Code Playgroud)

有没有办法在类 Unix 系统上运行输出二进制文件?

编辑:我需要它在沙盒环境中运行 g++ 的输出,在那里我不能写任何文件(我保证没有恶意)。

shell executable stdout

14
推荐指数
3
解决办法
3715
查看次数

ksh93怎么这么快?

所以,一般来说,我倾向于寻找sed文本处理 - 特别是对于大文件 - 通常避免在 shell 本身中做这些事情。

不过,我认为这可能会改变。我在四处闲逛,man ksh我注意到了这一点:

<#pattern     Seeks forward to the beginning of the
              next line containing pattern.

<##pattern    The same as <# except that  the  por?
              tion  of  the file that is skipped is
              copied to standard output.
Run Code Online (Sandbox Code Playgroud)

对现实世界的实用性持怀疑态度,我决定尝试一下。我做了:

seq -s'foo bar
' 1000000 >file
Run Code Online (Sandbox Code Playgroud)

...对于一百万行数据,如下所示:

1foo bar
...
999999foo bar
1000000
Run Code Online (Sandbox Code Playgroud)

...并将其与以下内容相提并论sed

p='^[^0-8]99999.*bar'
for c in "sed '/$p/q'" "ksh -c ':<##@(~(E)$p)'"    
do </tmp/file eval "time ( $c )"
done …
Run Code Online (Sandbox Code Playgroud)

shell ksh text-processing

9
推荐指数
1
解决办法
442
查看次数

标签 统计

shell ×2

executable ×1

ksh ×1

stdout ×1

text-processing ×1