#!/usr/local/bin/perl # Quote each argument. # When you run "sl *a*", the shell interprets the "*a*" and passes a list of files # in @ARGV. I noticed that things broke on a file named "#blah#" (like emacs creates), # and quoting each argument fixed that. map {$_ = "\"$_\""} @ARGV; my $hasLess = 1 unless ($^O eq 'aix'); # change as needed # (-E Causes less to automatically exit the first time it reaches end-of-file.) my $pager = $hasLess ? 'less -E' : 'more'; # put the command together $command = "ls -halt @ARGV | $pager"; # debugging # print "$command\n"; # You probably don't need this anymore but I think it's # harmless. (see $| in "perldoc -f exec".) $| = 1; # run the command and exit exec $command;