launch windows program from shell according to its extension

Andrew DeFaria Andrew@DeFaria.com
Wed Jun 8 16:43:00 GMT 2005


zzapper wrote:

> On Wed, 8 Jun 2005 10:59:27 -0400 (EDT), wrote:
>
>>> #!/bin/bash
>>> # csn
>>> # description : launch most recent file (head)
>>> # set -x
>>> cygstart $(l\s -t * | head -1) &
>>
>> Make that 'cygstart "$(/bin/ls -t | head -1)"' (add quotes, otherwise 
>> filenames with spaces will not work).
>
> Slightly improved to ignore directories (and assuming that Windows 
> files always have an extension) cygstart "$(/bin/ls -t *.* | head -1)"

You're making an invalid assumption that directories do not have 
extensions. They can!

The following works:

cygstart $(ll -t | grep -v "^d" | head -2 | tail -1 | awk '{print $NF}')


-- 
If an orange is orange, why isn't a lime called a green or a lemon 
called a yellow?


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list