[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Determining a scripts language?
- Subject: [ale] Determining a scripts language?
- From: eff at dragoncon.org (Scott M. Jones)
- Date: Wed, 6 Apr 2016 18:22:28 -0400
- In-reply-to: <CACv9p5pN_61HdAqoXRixTpzD1q5_pAC9Rw76-6iGmNfFR66O=A@mail.gmail.com>
- References: <CACv9p5pN_61HdAqoXRixTpzD1q5_pAC9Rw76-6iGmNfFR66O=A@mail.gmail.com>
Great answers in Stack Overflow, including a bash-only solution.
http://stackoverflow.com/questions/15060384/one-liner-in-bash-using-perl-or-awk-to-change-extension-of-multiple-files
On 4/6/16 5:52 PM, leam hall 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