Re: Script help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 19Sep2008 14:08, Dennis Kaptain <dkaptain@xxxxxxxxxxxx> wrote:
| > > Can anyone rattle this off of the top of their head?
| > 
| > `ls -t myfile*.txt | head -1` might work for you.
| 
| ls -t by itself may give you more than one filename per line. 
| Use ls -t1
| that will assure you get only one file name output from head.

Um, no. ls only multicolumns if you point its output to a terminal;
the multicolumning was an innovation brought in BSD. Earlier lses
always single columned, and continue to single column if sent to any
non-terminal. Otherwise every script on the planet reading from ls
would break.

So, you do not need the "1" option in a pipeline, and never have.

BTW, "sed 1q" is shorter than "head -1". I've never had much truck with
"head"...
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Almost nothing in Perl serves a single purpose. - Larry Wall in <199712040054.QAA13811@xxxxxxxx>

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux