[ale] Determining a scripts language?

Pete Hardie pete.hardie at gmail.com
Wed Apr 6 18:23:28 EDT 2016


Well, if the script names will not contain '.', a regex might serve (yeah,
I know "now you have TWO problems)



On Wed, Apr 6, 2016 at 6:06 PM, leam hall <leamhall at gmail.com> wrote:

> Yeah, I'm using basename to get just the script, but to strip the suffix
> you have to know it. That's the issue.
>
> On Wed, Apr 6, 2016 at 5:59 PM, Pete Hardie <pete.hardie at gmail.com> wrote:
>
>> Have you looked at basename and dirname?
>>
>> On Wed, Apr 6, 2016 at 5:52 PM, leam hall <leamhall at gmail.com> wrote:
>>
>>> I'm trying to do something simple, change the ending of a script to
>>> ".txt". So if it's my_script.sh it becomes my_script.txt. Likewise for
>>> my_script.rb, etc. The .txt version will have the documentation and
>>> comments.
>>>
>>> So far all I've some up with is:
>>>
>>>   IS_SH=`echo ${SCRIPTNAME} | grep -c sh$`
>>>
>>> For each expected script ending. Which seems a really ugly thing to do.
>>> Is there a better way in Bourne shell to do this?
>>>
>>> Leam
>>>
>>> --
>>> Mind on a Mission <http://leamhall.blogspot.com/>
>>>
>>> _______________________________________________
>>> Ale mailing list
>>> Ale at ale.org
>>> http://mail.ale.org/mailman/listinfo/ale
>>> See JOBS, ANNOUNCE and SCHOOLS lists at
>>> http://mail.ale.org/mailman/listinfo
>>>
>>>
>>
>>
>> --
>> Pete Hardie
>> --------
>> Better Living Through Bitmaps
>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>>
>
>
> --
> Mind on a Mission <http://leamhall.blogspot.com/>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>


-- 
Pete Hardie
--------
Better Living Through Bitmaps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20160406/2c6f3402/attachment.html>


More information about the Ale mailing list