Monday, January 19, 2015

Re: [LINUX_Newbies] Help with script and regex.

 

On 19Jan2015 22:38, J <dreadpiratejeff@gmail.com> wrote:
>On Mon, Jan 19, 2015 at 8:36 PM, Cameron Simpson cs@zip.com.au
>> The "«" is a _single_ character, not the "<<" redirection syntax associated
>> with here-documents. If the OP can type it easily (I'm using cut/paste myself)
>> it is entirely reasonable.
>
>Huh... How do you type that? (Yeah, I know you are using cut/paste)
>but how do you type that character in a shell? I had no idea there
>was an actual single character that is made up of two <'s

There's all sorts of... stuff... in Unicode.

I do not know how to type it, and even if I did I'm using a Mac so the
contortion would probably not work for you.

>> The { and } are not particularly special. In modern shells, {...,...} _is_
>> special as it performs enumeration eg foo{this,that}bah turning into
>> "thisfoothat" and "thisbarthat". However, it is _not_ special otherwise.
>>
>> For example, the find command's placeholder argument:
>>
>> find . -type f -name '*foo*' -exec echo found foo named {} ';'
>>
>> does not need any escaping on the shell command line for the {}; it has been so
>> for decades.
>
>OK... I thought it did need so. Interestingly, if I do this:
>
>touch {foo}
>
>and then this:
>
>ls {foo}

Reassuring.

>it works as you say, but if I tab-complete like this:
>
>ls {<TAB>
>
>tab complete does escape it like this:
>
>ls \{foo\}

That is because you might type "foo{this,that}bah", so since you're TAB
completing it the completer presumes it must match a filename, and therefore
for safety it escapes the { and }.

But you, as a user knowing your own intentions, need not do so.

>I've never seen tab complete escape something automatically before...
>so another new thing on me.

It has been pretty standard in bash and zsh for ages.

Maybe you don't deal in filenames with characters needing escaping often?

>>>Because to type that out on a shell (which you'd need to do in most
>>>scripts, right? maybe not in python, perhaps, but anything that is
>>>done in shell) you'd need to escape all that, and end up looking like
>>>this when typed in manually:
>>>
>>># \{2009\}|\<\<\{12\}\<\<\{04\}\<\<\{PHOTOS\}\<\<\{Pictures\}
>>
>> Really, you don't need to escape _any_ of this at a normal shell prompt.
>>
>> (Besides, with names that long one would normally use file completion:-)
>
>So as I said above, at least with my shell (Dash in Ubuntu 14.04)
>tab-complete does escape all the { and }s, I didn't try adding in that
>curious double arrow character.

Yah, paranoia as discussed above. The {} chars are in a bit of a grey area due
to these newfangled {a,b,c} expansion things.

>>>/Photography/2014/2014-04-25_Some_Event/raw/2014-04-25_Some_Event-001.raw
>>>/Photography//2014/2014-04-25_Some_Event/processed/2014-04-25_Some_Event-001.jpg
>>
>> Out of curiosity, do you use any specific tools to manage these?
>
>Nope. Each year I create a year directory, and every time I shoot a
>new event I save the RAW images as YYYY-MM-DD-Event_Name-SEQNUMBER and
>when I process any of them into portable formats like JPEG or GIF or
>anything else, they're exported using the same name. And the whole
>thing is saved under a folder using the same name... [...snip...]

You might want to consider PNG for export. At least it is lossless (and widely
supported). GIF is extremely lossy and JPEG is somewhat lossy depending on
your quality settings.

Cheers,
Cameron Simpson <cs@zip.com.au>

__._,_.___

Posted by: Cameron Simpson <cs@zip.com.au>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (9)
To unsubscribe from this list, please email LINUX_Newbies-unsubscribe@yahoogroups.com & you will be removed.

.

__,_._,___

No comments:

Post a Comment