The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
To call/execute a shell script from a shell script konark UNIX for Dummies Questions & Answers 1 10-26-2007 02:16 PM
How to pass a parameter from one Shell-script to another Shell-script subodhbansal Shell Programming and Scripting 2 09-22-2007 02:19 AM
How to Run a shell script from Perl script in Parent shell? hifake Shell Programming and Scripting 16 08-28-2007 05:42 PM
Accessing variables of one shell script in another shell script rsendhilmani Shell Programming and Scripting 1 04-30-2007 05:43 AM
Have a shell script call another shell script and exit heprox Shell Programming and Scripting 2 11-20-2006 05:17 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 03-16-2006
Registered User
 

Join Date: Mar 2006
Posts: 25
a shell script help

Question, please help.

I'd like to write a shell script, if use command line, should be two commands:

1, ls | tail -1
2, tail the last line of the file which is output of the line one

Could anyone can help?

- Thanks
Reply With Quote
Forum Sponsor
  #2  
Old 03-16-2006
Registered User
 

Join Date: Dec 2005
Location: India
Posts: 218
Hi,

I am confused in what exactly you need.
Can you please explain your problem a bit more,

Gaurav
Reply With Quote
  #3  
Old 03-17-2006
Registered User
 

Join Date: Jul 2005
Location: England
Posts: 183
I assume you mean this:

Code:
tail -1 `ls | tail -1`
Which gives you the last line of the last file lsited in the ls command.
Reply With Quote
  #4  
Old 03-17-2006
Registered User
 

Join Date: Mar 2006
Posts: 25
Smile

I found out the answer, using 'xargs',

the command should be:

ls | tail -1 | xargs tail -1


Thanks, everybody
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:12 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0