The $HOSTNAME shell variable on my Mac Book Pro (condor) was “condor.local” but I wanted it to be just “condor”. So I ran:
scutil --set HostName condor
which fixed the problem!
The $HOSTNAME shell variable on my Mac Book Pro (condor) was “condor.local” but I wanted it to be just “condor”. So I ran:
scutil --set HostName condor
which fixed the problem!
Am reading The C++ Programming Language, 4ed, by Bjarne Stroustrup and his sixth suggestion for Java programmers (pg 21) is:
Remember: a variable is never implicitly a reference.
I didn’t know that!
Found myself reading about values, variables, and literals in JavaScript.
Say you want to take an optional command line argument to your script. That means that maybe $1 is set to a value, or maybe it’s not. You can read out the value and assign a default in the case that $1 is not set using the syntax:
variable=${1:-default-value}
Which will set $variable to “default-value” if $1 is not set.
As I mentioned before I read (most of) Bash Internal Variables which has some great tips and tricks in it. There’s also stuff to learn about Debugging. In fact the whole of the Advanced Bash-Scripting Guide looks like a worthwhile read!
I read the Environment Variables section of Secure Programming for Linux and Unix HOWTO and learned about the IFS environment variable.
I also read CS 15-392 Secure Programming – Environment Variables.
The IFS environment variable is the “internal field separator” and it is typically space, tab, new line. I.e. white space used to separate fields. So in bash you can delete the IFR variable and it will default to ” \t\n” or you can set it explicitly to that value. So that explains why I found a script that unset the IFR variable — it’s a secure programming practice.