More shell questions (and GNU screen)

David Cantrell david at cantrell.org.uk
Wed Mar 9 10:25:19 GMT 2011


For kicking off my CPAN testing boxes I have a shell script that does
this once for each host that I use and each version of perl that it
tests with ...

screen -c c ssh -t pigsty.barnyard.co.uk "screen -dr test562 || (cd cpantesting;screen -S test562 sh -lc 'screen -c c;./run-tests-5.6.2;sh')"

What that does is:
  in the current screen session, open a new terminal
  in that terminal, ssh to pigsty.barnyard.co.uk
  then either
    connect to the existing screen session called test562 on that machine
  or
    change into the cpantesting directory
    start a screen session called test562
    within that
      open a second terminal with a shell in it
      and in the first terminal
        run the run-tests-5.6.2 script
	when that's finished, drop me to a shell

That's very useful.

But what I'd like is that when it opens the second terminal on the
remote host, it do this in there:
  run a script
  drop me at a shell prompt
  *and for that script that it just ran to be in the terminal history*

right now I have to start that script manually which then leaves
everything set up as I want.  I am lazy and wish to automate away twelve
keystrokes*, but I'm getting my arse kicked by shell quoting.  Hayulp!

* although across several hosts and versions of perl it comes to more
  like the same twelve keystrokes repeated a dozen times, which is
  annoying

-- 
David Cantrell | Nth greatest programmer in the world

Please stop rolling your Jargon Dice and explain the problem
you are having to me in plain English, using small words.
  -- John Hardin, in the Monastery


More information about the london.pm mailing list