[ale] Determining a scripts language?
DJ-Pfulio
djpfulio at jdpfu.com
Wed Apr 6 18:56:04 EDT 2016
Oh - the requirements changed? Not unusual. I was confused by the original
requirements saying
"change the ending of a script to ".txt" "
<rbg>
Sounds like you want to copy the file, not change it. I do this all the time.
Don't forget that extensions mean nothing to Unix. Look for the #! line at the
top to determine the real language. Ignore any bogus extensions. Heck, lots of
old-timers don't put any extensions on their scripts.
Will you be leveraging the built-in documentation tools for each scripting
language? Perldoc for example? Those tools should have a way to read the
script and dump the documentation somewhere else.
On 04/06/2016 06:19 PM, leam hall wrote:
> How is that different than multiple sed options?
>
> In this case scripts/my_script.sh will have a txt version HOWTO/my_script.txt,
> scripts/cool_stuff.rb will have HOWTO/cool_stuff.txt.
>
> So it's making a .txt file from *.sh or *.rb or perl or python or whatever. From
> the rename man page it renames the file in place. The original file should
> remain, I'm just pulling documentation out.
>
>
>
> On Wed, Apr 6, 2016 at 6:10 PM, DJ-Pfulio <DJPfulio at jdpfu.com
> <mailto:DJPfulio at jdpfu.com>> wrote:
>
> Or use the 'rename' tool? Uses regex, so
>
> $ rename 's/.rb$/.txt/g' *.rb
>
>
> On 04/06/16 17:52, 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
> >
> > --
> > Mind on a Mission <http://leamhall.blogspot.com/>
> >
> >
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org <mailto:Ale at ale.org>
> > http://mail.ale.org/mailman/listinfo/ale
> > See JOBS, ANNOUNCE and SCHOOLS lists at
> > http://mail.ale.org/mailman/listinfo
> >
>
>
> --
> Got Linux? Used on smartphones, tablets, desktop computers, media
> centers, and servers by kids, Moms, Dads, grandparents and IT
> professionals.
> _______________________________________________
> Ale mailing list
> Ale at ale.org <mailto: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
>
More information about the Ale
mailing list