ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Equivalent of os.resultof(...) in LaTeX
@ 2014-11-03 11:42 Xan
  2014-11-03 12:36 ` Herbert Voss
       [not found] ` <20141103143117.c44565778e0c8d5ac8b30377@telefonica.net>
  0 siblings, 2 replies; 7+ messages in thread
From: Xan @ 2014-11-03 11:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

Just short question: what's the equivalent in latex of 
\ctxlua{context(os.resultof("sha256sum \jobname.conTeXt | cut -c  -5"))}

?

Thanks in advance,
Xan
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Equivalent of os.resultof(...) in LaTeX
  2014-11-03 11:42 Equivalent of os.resultof(...) in LaTeX Xan
@ 2014-11-03 12:36 ` Herbert Voss
       [not found] ` <20141103143117.c44565778e0c8d5ac8b30377@telefonica.net>
  1 sibling, 0 replies; 7+ messages in thread
From: Herbert Voss @ 2014-11-03 12:36 UTC (permalink / raw)
  To: ntg-context

Am 03.11.2014 um 12:42 schrieb Xan:

> Just short question: what's the equivalent in latex of 
> \ctxlua{context(os.resultof("sha256sum \jobname.conTeXt | cut -c  -5"))}

\documentclass{article}
\begin{document}
\directlua{
 local handle = io.popen("sha256sum \jobname.tex | cut -c -5","r")
 if handle then
   local result = handle:read("*all") or ""
   handle:close()
   tex.print(result)
 end
}
\end{document}


or load l-os.lua, then the command os.resultof is available.

Herbert

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Equivalent of os.resultof(...) in LaTeX
       [not found] ` <20141103143117.c44565778e0c8d5ac8b30377@telefonica.net>
@ 2014-11-04  7:55   ` Xan
  2014-11-04  8:41     ` Herbert Voss
  2014-11-06 14:51     ` Xan
  0 siblings, 2 replies; 7+ messages in thread
From: Xan @ 2014-11-04  7:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, 3 Nov 2014 14:31:17 +0100
Xan <dxpublica@telefonica.net> ha escrit:

> It does not work:> \documentclass{article}
> > \begin{document}
> > \directlua{
> >  local handle = io.popen("sha256sum \jobname.tex | cut -c -5","r")
> >  if handle then
> >    local result = handle:read("*all") or ""
> >    handle:close()
> >    tex.print(result)
> >  end
> > }
> > \end{document}
> 
> Neither this:
> 
> > \directlua{
> >  require "lualibs-os"
> >  tex.sprint(os.resultof("sha256sum \jobname.tex | cut -c  -5"))
> > }
> 
> 
> Blank. Nothing displayed.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Equivalent of os.resultof(...) in LaTeX
  2014-11-04  7:55   ` Xan
@ 2014-11-04  8:41     ` Herbert Voss
  2014-11-06 14:51     ` Xan
  1 sibling, 0 replies; 7+ messages in thread
From: Herbert Voss @ 2014-11-04  8:41 UTC (permalink / raw)
  To: ntg-context

Am 04.11.2014 um 08:55 schrieb Xan:
> Xan <dxpublica@telefonica.net> ha escrit:
> 
> It does not work:>

That is not a useful error description ...

Herbert



 \documentclass{article}
>>> \begin{document}
>>> \directlua{
>>>  local handle = io.popen("sha256sum \jobname.tex | cut -c -5","r")
>>>  if handle then
>>>    local result = handle:read("*all") or ""
>>>    handle:close()
>>>    tex.print(result)
>>>  end
>>> }
>>> \end{document}
>>
>> Neither this:
>>
>>> \directlua{
>>>  require "lualibs-os"
>>>  tex.sprint(os.resultof("sha256sum \jobname.tex | cut -c  -5"))
>>> }
>>
>>
>> Blank. Nothing displayed.
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Equivalent of os.resultof(...) in LaTeX
  2014-11-04  7:55   ` Xan
  2014-11-04  8:41     ` Herbert Voss
@ 2014-11-06 14:51     ` Xan
  2014-11-06 15:10       ` Herbert Voss
  2014-11-07 11:20       ` Xan
  1 sibling, 2 replies; 7+ messages in thread
From: Xan @ 2014-11-06 14:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> That is not a useful error description ...
> 
> Herbert

More clear than this?

 Neither this:
 
 > \directlua{
 >  require "lualibs-os"
 >  tex.sprint(os.resultof("sha256sum \jobname.tex | cut -c  -5"))
 > }
 
 
 Blank. Nothing displayed.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Equivalent of os.resultof(...) in LaTeX
  2014-11-06 14:51     ` Xan
@ 2014-11-06 15:10       ` Herbert Voss
  2014-11-07 11:20       ` Xan
  1 sibling, 0 replies; 7+ messages in thread
From: Herbert Voss @ 2014-11-06 15:10 UTC (permalink / raw)
  To: ntg-context

Am 06.11.2014 um 15:51 schrieb Xan:
>> That is not a useful error description ...
>>
>> Herbert
> 
> More clear than this?
> 
>  Neither this:
>  
>  > \directlua{
>  >  require "lualibs-os"
>  >  tex.sprint(os.resultof("sha256sum \jobname.tex | cut -c  -5"))
>  > }
>  
>  
>  Blank. Nothing displayed.


 \directlua{
   require "lualibs-os"
   tex.sprint(os.resultof("sha256sum \jobname.tex"))
 }
\bye

luatex --shell-escape <file>
will work.

Herbert
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Equivalent of os.resultof(...) in LaTeX
  2014-11-06 14:51     ` Xan
  2014-11-06 15:10       ` Herbert Voss
@ 2014-11-07 11:20       ` Xan
  1 sibling, 0 replies; 7+ messages in thread
From: Xan @ 2014-11-07 11:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

luatex --shell-escape <file>
will work.

It works Thanks
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-11-07 11:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-03 11:42 Equivalent of os.resultof(...) in LaTeX Xan
2014-11-03 12:36 ` Herbert Voss
     [not found] ` <20141103143117.c44565778e0c8d5ac8b30377@telefonica.net>
2014-11-04  7:55   ` Xan
2014-11-04  8:41     ` Herbert Voss
2014-11-06 14:51     ` Xan
2014-11-06 15:10       ` Herbert Voss
2014-11-07 11:20       ` Xan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).