[1] https://github.com/yramagicman/dotfiles/blob/master/bin/upda...
[1] https://github.com/yramagicman/dotfiles/blob/master/bin/upda...
I keep intending to learn Perl really well, which I think could absorb much of Bash, and also Awk and Sed, and then there would be only one thing I needed to know for this kind of work, and I might use it enough to remember the various weird syntactic bits from one month to the next. But I never quite get over the hump.
Double-parentheses (( )) are only for arithmetic, e.g. "((count++))" or "echo $((1+1))"
The dollar sign precedes parentheses--i.e. $()--when you're substituting the output of a command, e.g. "echo Today is $(date)". It's easy to remember, because it's just like using the dollar sign for substituting the value of a variable, i.e. "date=$(date); echo $date".
You might want to look into the fish shell. Its scripting is much less idiosyncratic. You don't have to quote any variables, arrays, or command substitutions. e.g.:
set foods apple banana 'cucumber casserole'
for f in $foods
echo $f
end
prints: apple
banana
cucumber casserole
...not: apple
banana
cucumber
casserole
...as would be the case if you forgot to quote "$foods" and "$f" in Bash.[1] https://github.com/yramagicman/dotfiles [2] https://github.com/yramagicman/zsh-aliases [3] https://github.com/mathiasbynens/dotfiles/blob/master/.funct...
history | percol --prompt-bottom --result-bottom-up
I'm using fish, so the whole thing looks like this: function _percol_key_bindings
function __percol_ctrl_r
set tempfile (mktemp)
history | percol --prompt-bottom --result-bottom-up >$tempfile
and commandline (cat $tempfile)
commandline -f repaint
rm -f $tempfile
end
# Bind Ctrl+R to percol history function for now
bind \cr '__percol_ctrl_r'
end
[1]https://github.com/mooz/percol/