##############
+ # echoes the machine's hostname. can be used like so:
+ # local my_host=$(get_hostname)
+ function get_hostname()
+ {
+ # there used to be more variation in how to do this, but adopting mingw
+ # and cygwin tools really helped out.
+ local this_host=unknown
+ if [ "$OS" == "Windows_NT" ]; then
+ this_host=$(hostname)
+ elif [ ! -z "$(echo $MACHTYPE | grep apple)" ]; then
+ this_host=$(hostname)
+ elif [ ! -z "$(echo $MACHTYPE | grep suse)" ]; then
+ this_host=$(hostname --long)
+ elif [ -x "$(which hostname 2>/dev/null)" ]; then
+ this_host=$(hostname)
+ fi
+ echo "$this_host"
+ }
+
+ ##############
+
# NOTE: no more function definitions are allowed after this point.
function function_sentinel()
#echo "hostname is $this_host"
}
-# this function sets a variable called "home_system" to "true" if the
-# machine is considered one of fred's home machines. if you are not
-# fred, you may want to change the machine choices.
-function is_home_system()
-{
- # load up the name of the host.
- get_our_hostname
- # reset the variable that we'll be setting.
- unset home_system
- export home_system
- if [[ $this_host == *.gruntose.blurgh ]]; then
- home_system=true
- fi
-}
-
#hmmm: move to core.
# makes sure that the "folder" is a directory and is writable.
# remember that bash successful returns are zeroes...