3 ms·
I use autohotkey to script some of my favorite things, which is another great way to get good use out of the command line on various systems where I don't neces
by geocrasher 5y ago
I use autohotkey to script some of my favorite things, which is another great way to get good use out of the command line on various systems where I don't necessarily need/want to set up a .bashrc.
hotkey: "du-m"
Use: Sort directories by usage:
du -m --max-depth=1 | sort -n
hotkey: "wpinfo"
Use: gets basic WordPress site info:
code for AHK
::wpinfo::
(
echo Home URL $(wp option get home) ; echo Site URL $(wp option get siteurl);echo "###
Plugins ###"; wp plugin list;echo "### Themes ###"; wp theme list;echo "### Users ###";
wp user list; echo "### Roles ###"; wp role list; wp core verify-checksums
)
hotkey: awk(1-5)
use: saves me typing something I fat finger every. single. time.
awk '{ print $1 }'
awk '{ print $2 }'
awk '{ print $3 }' etc
AHK:
::awk1::awk '{{} print $1 {}}'
There are others but these are the ones that come to mind. The main thing isn't the scripts but the automation. And AHK can save a ton of error-prone typing or copy/pasting in these scenarios.
- xorcist 5y agoOf all the things awk can do, I will never understand the popularity of echoing an argument. The same thing in bash would be: $ arg1 () { echo $1; } $ arg1 one two three one Splitting fields is easy with cut: $ echo one two three | cut -f 1 -d " " one Normally you just want to stuff it into a variable in which case read is much easier: $ read arg1 arg2 arg3 < <(echo one two three) $ echo arg1 one Symbolic names are normally much easier to read than numeric positions. That last example looks a bit weird with <() instead of a pipe, but that's just because the right hand side of a pipe is a separate shell so setting variables in it is a bit useless. It's nothing specific to read.