3 ms·
Stuff like https://github.com/p8952/bocker/blob/master/bocker#L94 https://github.com/p8952/bocker/blob/master/bocker#L94 is super dense. I might write that som
by fwip 7y ago
Stuff like https://github.com/p8952/bocker/blob/master/bocker#L94 https://github.com/p8952/bocker/blob/master/bocker#L94 is super dense.
I might write that something like:
cid="$(
ps o ppid,pid |
grep "^$(
ps o pid,cmd |
grep -E "^\ *[0-9]+ unshare.*$1" |
awk '{print $1}'
)" |
awk '{print $2}'
)"
- Hello71 7y agoor maybe even cid=$(pgrep -P $(pgrep -f "unshare.*$1")).
- stingraycharles 7y agoI agree with you that their code is fairly dense, yours is overly verbose. Having said that, looking at their code, I don’t get the impression they’re optimizing for LOC. There is plenty of verbosity and opportunity to remove lines of code if they wanted.
- cyansmoker 7y agoCan confirm. The bocker code (incl. my modest contributions) was targeted towards showing that the Linux toolbox was available and scriptable.
- travbrack 7y agoMaybe I've spent too much time writing one-liners in bash but I really prefer the original to yours. I can read the original much faster because it matches the pattern for how I write bash on the command line. Yours looks totally foreign to how bash is normally written. Not saying one is better than the other, just my personal preference.
- fwip 7y agoDang, didn't expect the downvotes for sharing my bash coding style. :(