Senior Weasel,
Indeed "dirname" is the way to go.
I got bigger problems... I cannot get beyond one include.
Regards,
Paul
On Wed, 26 Oct 2016, Eric Howard wrote:
Date: Wed, 26 Oct 2016 15:25:21 -0400 (EDT)
From: Eric Howard <[email protected]>
To: Paul Flint <[email protected]>
Cc: Eric Howard <[email protected]>, Kevin Cole <[email protected]>,
Anthony Carrico <[email protected]>,
Adult Swim <[email protected]>,
Vermont Area Group of Unix Enthusiasts <[email protected]>,
Eric Howard <[email protected]>, Tom Hoffman <[email protected]>,
Jeffrey Elkner <[email protected]>
Subject: Re: Bash Decorators
If you had bothered to look at the man page or looked at Kevin's email you
would have found dirname: https://linux.die.net/man/1/dirname
Dear Eric,
What I need is kinda the opposite of basename. That said, basename is
cool, I simply never encountered it...
Regards,
Flint
On Wed, 26 Oct 2016, Eric Howard wrote:
Date: Wed, 26 Oct 2016 10:35:18 -0400 (EDT)
From: Eric Howard <[email protected]>
To: Kevin Cole <[email protected]>
Cc: Paul Flint <[email protected]>, Anthony Carrico
<[email protected]>,
Adult Swim <[email protected]>,
Vermont Area Group of Unix Enthusiasts <[email protected]>,
Eric Howard <[email protected]>, Tom Hoffman
<[email protected]>,
Jeffrey Elkner <[email protected]>
Subject: Re: Bash Decorators
Good grief, basename ships with every version of Linux:
https://linux.die.net/man/1/basename
Obfuscated sed ;-)
I was looking at your means of achieving only the file name from a
file path, and thought "... but isn't this a job for regex and sed?"
Well... maybe. It depends on how comfy you are with the line noise of
regular expressions. (In the following, you can replace the "#" by
any delimiter character you're not using for something else.) Try:
$ locate flint/.bashrc
$ locate flint/.bashrc | sed -e "s#\(.*\)/\(.*\)#\2#"
The first should return "/home/flint/.bashrc" and the second should
return ".bashrc"
That said, the "flip the string, strip off everything after and
including the 'first' slash and flip the string again" is fun and
clever.
Now, off to look at the whole decorator "thang", which I never really
grok in Python and only use when some example / tutorial explicitly
says "put this in your code and smoke it".
Kindest Regards,
â?® Paul Flint
(802) 479-2360 Home
(802) 595-9365 Cell
/************************************
Based upon email reliability concerns,
please send an acknowledgement in response to this note.
Paul Flint
17 Averill Street
Barre, VT
05641
Kindest Regards,
☮ Paul Flint
(802) 479-2360 Home
(802) 595-9365 Cell
/************************************
Based upon email reliability concerns,
please send an acknowledgement in response to this note.
Paul Flint
17 Averill Street
Barre, VT
05641