Shell Script in TextExpander (adding unwanted line shift)

So I’ve started setting up some TextExpander stuff to automate more of my life.

Inspired by the latest podcast I decided to create a snippet to automate an email I send once per month to start learning to use the various features.

Since the email contains the full name of the previous month in my local language (Norwegian) this wasn’t supported directly. The suggested solution from Smile is to use Shell Script for this.

I created a Shell Script snippet which I nested into the main snippet - but it’s adding a line shift for some reason… am I missing some setting or is this a bug? Any workaround?

The Shell Script snippet is:

#!/bin/bash
LANG=no_NO.UTF-8
date -v1d -v-1m “+%B %Y”

I would expect it to return:

“juni 2018”

But it returns:

“juni 2018

Which messes up the full text…

Take a look at this thread.

1 Like

Doh. I didn’t even imagine that this line shift would be a built in feature of the date command, so I searched in all the wrong places! :unamused:

This works perfectly! THANKS!

#!/bin/bash
LANG=no_NO.UTF-8
date -v1d -v-1m “+%B %Y”|tr -d “\n”

I’ve had that before in scripts and it’s just one of those niggling things you end up going the long way round to fix.

The fact that I discovered Mac Power Users earlier this Summer and that Automators got launched now is going to cause havoc in my life. It’s just too much useful stuff being thrown around to not follow-up on - so need to up my Apple Script knowledge considerably, learn at least some basic Shell Script, and get to know a not so small set of automation Apps… at least it’s fun and full of small victories! :smiley:

1 Like