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
AWK syntax question Leo_NN UNIX for Dummies Questions & Answers 5 10-28-2008 11:18 AM
Piping Question mtobin1987 High Level Programming 2 04-25-2008 11:24 PM
question about grep, cut, and piping dyrt Shell Programming and Scripting 1 02-28-2008 10:12 PM
yet another awk field syntax question prkfriryce Shell Programming and Scripting 4 03-22-2007 12:13 PM
awk syntax question hcclnoodles Shell Programming and Scripting 2 10-28-2004 12:45 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-20-2008
Registered User
 

Join Date: Nov 2008
Posts: 4
Piping syntax question

There are are lots of examples of piping output FROM the 'ls' command TO another command, but how does one pipe output TO the 'ls -l' command?

For example, use 'which' to find a file, then use 'ls -l' to view the permissions, groups, etc. in a single step:

which <filename> | ls -l

returns a long listing of the current directory, not a long listing of the filename and path returned by the 'which' command.

which <filename> | ls -l -

returns a file not found error on '-'

Suggestions, please. Thanks!

John
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-20-2008
Ikon's Avatar
Registered User
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 665
Code:
ls -l `which <filename>`
Reply With Quote
  #3 (permalink)  
Old 11-20-2008
Registered User
 

Join Date: Nov 2008
Posts: 4
Thanks, Ikon!
Reply With Quote
  #4 (permalink)  
Old 11-20-2008
Registered User
 

Join Date: Dec 2007
Location: Paris
Posts: 761
Code:
a=$(which filename) && ls -l $a
Reply With Quote
  #5 (permalink)  
Old 11-20-2008
Registered User
 

Join Date: Nov 2008
Posts: 4
Quote:
Originally Posted by jlliagre View Post
Code:
a=$(which filename) && ls -l $a
Thanks for that alternate solution, jlliagre!

That's better than my idea of doing the same thing with multiple commands on a single commandline with a command separator between them.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Bookmarks

Tags
None

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:




All times are GMT -4. The time now is 04:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66