Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • For users, it's simply:

    xterm &
  • do script with command "cd \"" & thePath & "\""

    Pray that the current directory path never contains any shell metacharacters other than spaces.

  • I don't use Terminal much, I prefer iTerm. But, for Terminal:

    use Cwd;
    use Mac::Glue;
    (my $cwd = cwd()) =~ s/'/'\\''/g;
    my $term = new Mac::Glue 'Terminal';
    $term->do_script(with_command => "cd '$cwd'");

    For iTerm:

    my $iterm = new Mac::Glue 'iTerm';
    my $term = $iterm->make(new => 'terminal');
    $term->Launch(session => 'default');
    $term->obj(session => 1)->write(text => "cd '$cwd'");

    • I found this through a search, but ended up with my own version [] using pbcopy / pbpaste on a one-liner.

      echo `pwd` | pbcopy; osascript -e "tell application \"Terminal\" to do script \"cd \\\"`pbpaste`\\\"\""