GNU World Order Linux Cast

GNU, Linux, coffee, and subversion. This podcast is founded in the ideals of anarcho-syndacalism, anti-facism, and human rights. I stand in solidarity with all people of colour, of marginalised communities, and the oppressed around the globe.

http://www.gnuworldorder.info

subscribe
share






gnuWorldOrder_13x12


The journey through the **util-linux** from the **a** package set of Slackware continues. First, a tutorial on `getopt`, an argument parser for Bash and Tcsh. Here is a demonstrative sample script: #!/usr/bin/bash ## or you can just use /bin/sh OPTS=`getopt --options f --long foo --alternative -- "$@"` eval set -- "$OPTS" echo "Raw input: $OPTS" while true ; do case "$1" in -f|--foo) echo "Option f has been toggled on" ; shift ;; --) shift ; break ;; esac done # this outputs anything # left over after parsing # valid options for i in "$@" ; do echo "$i" done You can add more options, and you can add an allowance for arguments. Here is a slightly more complex version of the script: #!/usr/bin/bash OPTS=`getopt --options f,b: --long foo,bar: --alternative -- "$@"` eval set -- "$OPTS" echo "$OPTS" while true ; do case "$1" in -f|--foo) echo "Option f has been toggled on" ; shift ;; -b|--bar) echo "Option b has been set to $2" ; shift 2 ;; --) shift ; break ;; esac done for i in "$@" ; do echo "$i" done After the coffee break, Klaatu covers `kill`. Because he recorded this episode on the same night as the previous episode, he does make reference to some settings from the previous episode (specifically, a hostname setting). That makes this episode a sequel to the previous one, meaning Klaatu owes you an extra episode sometime. Also, `mountpoint`, `mount`, `unmount`, `wdctl` and `watchdog` [gnu.org/software/libc/manual/html_node/Example-of-Getopt.html](https://www.gnu.org/software/libc/manual/html_node/Example-of-Getopt.html) A great article about the `eval` and `set` on [Linux Journal](https://www.linuxjournal.com/content/bash-preserving-whitespace-using-set-and-eval) [Watchdog daemon](http://www.sat.dundee.ac.uk/psc/watchdog/watchdog-testing.html) [Systemd interface to Watchdog](http://0pointer.de/blog/projects/watchdog.html) shasum -a256=7b92289327d6320246fad8021f23e6eb4de506db761f8f199eda02a2ed133e6f


fyyd: Podcast Search Engine
share








 March 18, 2019  n/a