小编Fel*_*rez的帖子

while循环的输入来自`command`的输出

#I used to have this, but I don't want to write to the disk
#
pcap="somefile.pcap"
tcpdump -n -r $pcap > all.txt
while read line; do  
  ARRAY[$c]="$line"
  c=$((c+1))  
done < all.txt  
Run Code Online (Sandbox Code Playgroud)

以下无法正常工作.

# I would prefer something like...
#
pcap="somefile.pcap"
while read line; do  
  ARRAY[$c]="$line"
  c=$((c+1))  
done < $( tcpdump -n -r "$pcap" )
Run Code Online (Sandbox Code Playgroud)

在谷歌搜索结果太少(不明白,我想找到:(什么的).我想保持它Bourne兼容(/ bin/sh的),但它并不具备如此.

shell loops while-loop

18
推荐指数
2
解决办法
4万
查看次数

GNU 并行显示剩余的作业

我想这个问题/问题可以通过满足以下一个(或多个)问题来解决

1) 如何显示剩余的工作?2)我如何漂亮的输出--eta

1) 我已经检查了手册页,我目前在我的函数中使用 $PARALLEL_SEQ,但是我怎样才能获得剩余的工作?Parallel 帮助我编译了大约 800 个文件,我想知道我的剩余工作。

2)或者,有没有更好(更好)的输出方式--eta?我的输出看起来很乱。我只想看到一个 ETA。

我使用的并行标志: --no-notice --keep-order --group

输出示例:

819: Compiling form: USER_Q                         ok
ETA: 8s 13left 0.61avg  local:4/819/100%/0.6s

820: Compiling form: USER_RESERVE_STOCK             ok
ETA: 7s 12left 0.61avg  local:4/820/100%/0.6s

821: Compiling form: USERS_AUTO                     ok
ETA: 7s 11left 0.61avg  local:4/821/100%/0.6s

822: Compiling form: USERS                          ok
ETA: 6s 10left 0.61avg  local:4/822/100%/0.6s

823: Compiling form: USERS_MENU                     ok
ETA: 6s 9left 0.61avg  local:4/823/100%/0.6s

824: Compiling form: USER_SUPP                      ok
ETA: 4s 8left 0.61avg  local:4/824/100%/0.6s

825: …
Run Code Online (Sandbox Code Playgroud)

parallel-processing gnu-parallel

5
推荐指数
1
解决办法
488
查看次数

git快进一个提交

* 9dbd857 (hotfix-correct-java-jdk-path, feature/add-ansible-galaxy-requirements-file) requirements.yml: adds maven and nodejs requirements
* 1643619 (QOL-1640-enable-vpc-peering) roles/ansible-linux-commons: change value of hostname in cloud-init
* b5fd2a4 roles/bamboo-agent: add bitbucket ssh host key to /etc/ssh/ssh_known_hosts
* d5cc1f7 vpc cfn template: produce outputs conditionally
* 3b87efe vpc cfn template: use csv for subnet/AZ mapping
* 2e93096 roles/bamboo-agent: Install chrome on agents
* 9aeb07e roles/bamboo-agent: install chromium browser
* 89e852d (HEAD -> feature/QOL-1649-install-chrome) README: display the current directory structure of inventories
* 1f55c4b inventories/test: define root volume …
Run Code Online (Sandbox Code Playgroud)

git fast-forward

3
推荐指数
2
解决办法
2206
查看次数

在我的Fibonacci C++代码中找不到分段错误的原因

我的代码是segfaulting.我不明白为什么.它可能与我制作的"fermatPrimeTest()"函数有关.

#include <iostream>
#include <cmath>
#include <cstdlib>
#include "fib.h"
using namespace std;

bool fermatPrimeTest( unsigned long int p )
{
  if ( p % 2 == 0 ) { // if even
    return false;
  } 
  else if ( p == 1 || p == 2 || p == 3 ) { // if 1, 2, or 3
    return true;
  }
  unsigned long a = 2 ; // just give it an initial value, make it happy
  for ( int i=0 …
Run Code Online (Sandbox Code Playgroud)

c++ segmentation-fault

0
推荐指数
2
解决办法
681
查看次数