News for hackers. Stuff that matters.
Re:IPython as a System Shell by tyingq on Tuesday April 06, 2021 @10:19AM (#26712055)
You might like Perl. The syntax to invoke and interact with processes is much more terse than Python's. And there's quite a lot of history of using it instead of shell scripts.

Edit: Things like:

  $output=`ls`;

  $output=qx#ls -l#;

  system('/bin/echo','avoid','subshell','invocation');

  open("APIPELINE","ls -l |");
  while (<APIPELINE>) {
     chomp;
     print "Got line: [$_]\n";
  }
  close(APIPELINE);
  
And access to child exit status in a way that's familiar ($?), etc.
Re:IPython as a System Shell by dale_glass on Tuesday April 06, 2021 @11:32AM (#26713075)
That Perl is quite out of date.

These days, Perl has 3 argument open, and can use a variable for a filehandle. So:

    open(my $pipeline, "-|", "ls -l");

This is a good thing, because you can treat a filehandle as a standard variable, and can separate the special stuff from the command itself. This way if you're taking in user input, they don't get to mess with that. You can also do:

    open(my $pipeline, "-|", "ls", "-l", $directory);
Which lets you get away from the mess of correct quoting and just pass every parameter exactly as intended.