4
votes
output of a command framed by a couple of '#' characters
If you want to make the lines the same length, the tricky part is printing a correct amount of # signs dynamically. You could do something like this (in Bash or zsh):
#!/bin/bash
fill() {
local ...
3
votes
Accepted
How to modify this git alias so it can be run without the need to put multiword commands in quotation?
I think this will do what you want:
git config --global alias.all \
'!'"f() { ls -R -d */.git | xargs -I{} bash -c 'echo {} && git -C {}/../ \"\$@\"' -- \"\$@\"; }; ...
2
votes
output of a command framed by a couple of '#' characters
You could also use a tool for ASCII-art, e.g. install boxes. For details see also the long answer in related question.
Adapted the example:
psql -qAtc "SELECT version()" | awk {'print $1, $2'...
2
votes
Accepted
Why doesn't 'export' give the export attribute while 'set -a' does?
It's the one and same export attribute, just the help texts there aren't too consistent with each other. The export attribute is how the shell marks variables for (automatic) export.
export gives the ...
1
vote
output of a command framed by a couple of '#' characters
Some things aren't actually worth writing code for, and this is one of those cases.
I would expect the version of PostGreSQL to change infrequently, so it shouldn't need to be calculated every time ...
1
vote
Accepted
output of a command framed by a couple of '#' characters
You should be able to output the result of that command using a combination of $() and quote marks like so-
echo "### $(psql -qAtc "SELECT version()" | awk {'print $1, $2'}) ############...
1
vote
Delete 2-line paragraphs, keep 3-line paragraphs, maintain newline between all
With GNU awk:
awk 'BEGIN{FS=RS; RS=""} NF==3{print; print ""}' file
Output:
aaa aaaaaa
bb bbb
cc cccc ccccc cccc
fff ff
ggg gggg gggg
hhh hhh hh hhhh
Output contains one ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
bash × 27520shell-script × 6888
shell × 4150
linux × 2852
scripting × 1542
awk × 1005
command-line × 976
sed × 958
terminal × 800
text-processing × 713
grep × 712
ssh × 707
find × 674
variable × 638
ubuntu × 584
io-redirection × 579
zsh × 576
pipe × 558
files × 538
environment-variables × 525
quoting × 507
alias × 503
wildcards × 453
command-history × 453
regular-expression × 436