## Posts

Showing posts from 2019

### Bash shell syntax goodies and gotchas

In my time bash scripting, I've come across a number of CLI goodies and gotchas, so I've decided to compile a post with a list of neat examples. These may be about individual packages or specific to the shell.

pdflatex -- the order of arguments matters :( For instance, I've written a bash script that's cron-scheduled to re-compile my resumé each morning. But, you must specify flags and options before the file name you're aiming to compile.pdflatex -var-value="$out" -output-directory="$misc" "$location" Otherwise, it fails. Watch out for rm'ing against filesystems as such -- read -r -p "Give me a file to delete: " var rm -r "$var/" If $var does not contain anything, then this could destroy your machine :P Instead, use rm -r "${var:?}/" For example, on my own machine -- root@ideapad:~# read -r -p "This: " that; echo "${that:?}/" This: -bash: that: parameter null or not set root@ideap… ### Setting up a virtual router at home This post is a bit of a mind-dump, but I thought I'd write down things I learned this past weekend while switching my home router from a physical NetGear R6260 to a virtual pfSense instance. I've also been recommended to use OPNSense by my colleagues for a nicer interface, but I'll stick with pfSense for the moment. The reason for making the switch includes the fact that VLAN configuration on the R6260 requires a reboot on every modification, and moreover, you can't have more than one VLAN on each physical port. I'm not exactly sure why that would be the case, either. Hardware To start, I purchased an i340-T4 card on eBay for ~$25. Brand new, these cards are still running at \$100 or more, but mine works just fine for the price. (The only thing I wasn't happy about was that it arrived sitting in bubble wrap instead of an ESD bag.)

After shutting down my host and installing the card, I didn't see the interfaces come up automatically (as expected). Instead, …