You are here

lufthans's blog

Comparing Strings in the Shell: Pattern Substitution Operator

One problem with using the truncate operator for string matching is case matching.

In the truncate operator example, ${foo%%*ATE} matches SENATE.


DALEK$ foo=SENATE
DALEK$ if [ '' = "${foo%%*ATE}" ] ; then echo "$foo! $foo!"; fi
SENATE! SENATE!
DALEK$

It will not match Senate because ate and ATE are different cases.


DALEK$ foo=Senate
DALEK$ if [ '' = "${foo%%*ATE}" ] ; then echo "$foo! $foo!"; fi
DALEK$

Comparing Strings in the Shell: Truncate Operator

While creating materials for my bash class I needed to create some globbing exercises for my students.

It occurred to me that a string operator and a comparison to the null string can be used to check if something is a substring of another value.

Sure, you can use Substring Expansion to see if the substring is at a known location such as "Does the value of $foo start with 'bar'?", but length and location are often unknown.


$ foo=barfood
$ if [ 'bar' = "${foo:0:3}" ]; then echo $foo; fi
barfood
$

LibrePlanet 2018 Experience

LibrePlanet, the Free Software Foundation's annual technology conference, was a great experience in March.

The conference started with a fantastic keynote from Deb Nicholson, "Free software forever."

PLUG end of year party recap

PLUG's end of year party was last night. We had a good turnout. Congratulations to our new parents who weren't in attendance. Take care of the family, we'll be here :).

We had some good food as well. That included another delicious reminder that Spanish tortilla is different than Mexican tortilla. We also had a great orange cake. Baked good go over well for some reason. Other items included: ham ( very moist out of a crockpot ), chicken, casserole, cucumber salad, chips and salsa ( we are in Phoenix ), hummus, cupcakes, cookies and donuts.

The PLUG end of year schedule set

Stammtisch will meet as normal in November ( on the 20th ) and December ( on the 18th ) at Boulders on Southern, 1010 W Southern Ave, Mesa.

In December the PLUG east side meeting is a pot luck party.

There will be no security meeting in December. Security meetings will start again in January.

For the end of year pot luck, bring some friends and family.

PLUG October security class

Topics: Firejail, AppArmor and SELinux

In October Aaron will be teaching us about locking down processes via three diff
erent mechanisms.

  • Firejail: sandbox to restrict the application environment
  • AppArmor: a Mandatory Access Control system, common for debian based distros
  • SELinux: a Mandatory Access Control system, common for Red Hat based distros

The PLUG security meeting is a monthly open entry security class ( 3rd Thursday ).

Free Software Stammtisch job networking Tuesday night

Free Software Stammtisch job networking event this Tuesday at 18:00.

We encourage engineers from groups that are hiring and hiring managers to attend. The goal is for prospective candidates to learn about the company and the actual job while giving the team a chance to meet prospective candidates. Interviews are bi-directional, so are job searches.

We have several confirmed employers this month:

October PLUG east side meeting

Topic: Command Line Tools Seminar
Instructor: Ryan Hermens

This month's east side meeting is a seminar on important command line tools. It's a good month to bring friends and family that have interest in GNU/Linux.

Thursday, October 11th @ 19:00

CactusConKids++

CactusConKids was even better this year. #CactusCon is a two day regional security conference in #Arizona with a couple thousand attendees.

The one day program added an escape room. To participate in the escape room kids had to first complete three stations: lock picking, arduino updates and a simple breadboard build.

Each of the three rooms in the escape challenge had a puzzle matching one of the three pre-requisite skill stations. Each room also had a hack to bypass the challenge. CactusCon is a hacker/security conference after all :).

SeaGL accepted my etckeeper talk

SeaGL accepted one of my talks again this year! This year I'll speak about Joey Hess' excellent etckeeper.

etckeeper makes it easy to keep system configuration files in revision control. In addition to normal revision control, etckeeper includes important features to track file ownership and permissions, work with package managers and track empty directories. etckeeper supports git, mercurial, bazaar and darcs revision control systems.

Pages

Subscribe to RSS - lufthans's blog