[Jprogramming] Example bash shell scripts using J 7.01'
Björn Helgason
gosinn at gmail.com
Fri Sep 30 00:53:08 HKT 2011
Changed you bat a bit
echo on
title Running TeXt J preprocessor ...
pushd
setlocal
if exist c:\j701\bin\jconsole.exe set jexe=c:\j701\bin\jconsole -js
set jscr="0!:0<'c:/j701/bin/testscript.txt'"
rem run J process and exit
%jexe% %jscr% "3+30" "testout 0" "exit 0"
title TeXt J preprocessor complete!
goto TheEnd
:Exception01
echo ERROR: jconsole.exe not found
title TeXt J preprocessor abended!
goto TheEnd
:TheEnd
endlocal
popd
rem notepad out.txt
---------
added testscript
----------
testout=:3 : 0
smoutput 'hallo'
'hallo til þin' fwrite 'out.txt'
)
---------
2011/9/29 John Baker <bakerjd99 at gmail.com>
> Thanks Bill,
>
> Bash is quite different from windows bat scripts in that you
> cannot embedded j code in bat. You pass arguments to
> the jconsole.exe. The following example is typical of the types of
> scripts I hack together
>
> echo off
> title Running Dud/TeX J preprocessor ...
> pushd
> setlocal
>
> rem set script executable from standard locations
> if exist c:\j701\bin\jconsole.exe set jexe=c:\j701\bin\jconsole -js
> if exist "c:\Program Files\j701\bin\jconsole.exe" set jexe="c:\Program
> Files\j701\bin\jconsole" -js
> if "%jexe%" == "" goto Exception01
>
> rem set Dud/TeX preprocessor J script
> set jscr="0!:0<'c:/jod/j701/docs/script/DudTeXPreprocess.ijs'"
>
> rem run J process and exit
> %jexe% %jscr% "RunDudPreprocess 0" "exit 0"
> title Dud/TeX J preprocessor complete!
> goto TheEnd
>
> :Exception01
> echo ERROR: jconsole.exe not found
> title Dud/TeX J preprocessor abended!
> goto TheEnd
>
> :TheEnd
> endlocal
> popd
>
>
>
> On Thu, Sep 29, 2011 at 10:07 AM, bill lam <bbill.lam at gmail.com> wrote:
>
> > Not J701 specific or particularly nice,
> >
> > where eol.ijs is
> >
> > #!/usr/bin/jb
> >
> > 3 : 0''
> > for_f. }.ARGV do.
> > if. LF~:{:t=. 1!:1 f do.
> > stdout LF,>f
> > (t,LF) 1!:2 f
> > end.
> > end.
> > )
> > exit 0
> >
> > (in retrospect, 1!:3 should be used instead of 1!:2)
> >
> > I am also interested to know how windows batch file can contain j script.
> >
> > Чтв, 29 Сен 2011, John Baker писал(а):
> > > I am in the process of converting a slew of windows batch scripts that
> > > employ jconsole.exe to linux bash scripts.
> > >
> > > It would be a big help to look at some examples. If anyone out in
> > J/linux
> > > land has some nice script examples they are willing to share please
> post.
> > >
> > > One good example > reams of documentation.
> > >
> > > --
> > > John D. Baker
> > > bakerjd99 at gmail.com
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> > --
> > regards,
> > ====================================================
> > GPG key 1024D/4434BAB3 2008-08-24
> > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
>
> --
> John D. Baker
> bakerjd99 at gmail.com
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Björn Helgason, Verkfræðingur
Fornustekkum II
781 Hornafirði,
t-póst: gosinn at gmail.com
gsm: +3546985532
twitter: @flugfiskur
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=) ♖♘♗♕♔♙
`. )----' (")_(") ☃☠
More information about the Programming
mailing list