Task

Run either the   ls   system command   (dir   on Windows),   or the   pause   system command.




Related task
  Get system command output


 
#!/usr/bin/hopper
 
#include <hopper.h>
 
main:
 
  /* execute "ls -lstar" with no result return (only displayed) */
  {"ls -lstar"},execv
 
  /* this form does not allow composition of the line with variables.
     Save result in the variable "s", and then display it */
  s=`ls -l | awk '{if($2=="2")print $0;}'`
  {"\n",s,"\n"}print
 
  data="2"
  {""}tok sep
 
  // the same as above, only I can compose the line:
  {"ls -l | awk '{if($2==\"",data,"\")print $0;}'"}join(s),{s}exec,print
  {"\n\n"}print
 
  // this does the same as above, with an "execute" macro inside a "let" macro:
  t=0,let (t := execute( {"ls -l | awk '{if($2==\""},{data},{"\")print $0;}'"} ))
  {t,"\n"}print
 
{0}return
 