The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 12:18 PM
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 11:12 PM
yet another awk field syntax question prkfriryce Shell Programming and Scripting 4 03-22-2007 01:13 PM
awk syntax question hcclnoodles Shell Programming and Scripting 2 10-28-2004 12:45 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-20-2008
johne1 johne1 is offline
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
  #2 (permalink)  
Old 11-20-2008
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 669
Code:

ls -l `which <filename>`
  #3 (permalink)  
Old 11-20-2008
johne1 johne1 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 4
Thanks, Ikon!
  #4 (permalink)  
Old 11-20-2008
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlosuǝdo
  
 

Join Date: Dec 2007
Location: Paris
Posts: 1,265
Code:
a=$(which filename) && ls -l $a
  #5 (permalink)  
Old 11-20-2008
johne1 johne1 is offline
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.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 08:02 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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