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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
tell me whats wrong with this nadman123 Shell Programming and Scripting 1 04-14-2008 11:58 PM
tell me whats wrong in this? nadman123 Shell Programming and Scripting 1 04-10-2008 01:11 AM
Whats wrong with this script? kayarsenal Shell Programming and Scripting 2 08-25-2006 09:58 AM
Whats wrong with the mv command dsravan Shell Programming and Scripting 0 08-10-2006 03:30 PM
whats wrong with this awk??? george_ Shell Programming and Scripting 5 04-04-2006 04:58 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-15-2008
nadman123 nadman123 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 23
whats wrong with this code

ls -ld | grep $1 /etc/passwd | cut -d: -f6

i need see the content...
  #2 (permalink)  
Old 04-15-2008
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
  
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 2,976
$1 is the first argument of a command... i don't understand what you want to achieve with the above...
  #3 (permalink)  
Old 04-15-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,307
If you want to ls for directories of the homedirectory of user $1:

Code:
ls -ld $(grep "$1" /etc/passwd | cut -d: -f6)
Regards
  #4 (permalink)  
Old 04-15-2008
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by Franklin52 View Post
If you want to ls for directories of the homedirectory of user $1:

Code:
ls -ld $(grep "$1" /etc/passwd | cut -d: -f6)

There's no need to look at /etc/passwd or to use an external command (unless your shell doesn't have printf built in):

Code:

eval "printf '%s\n' ~$1/*/"
  #5 (permalink)  
Old 04-15-2008
krishmaths krishmaths is offline
Registered User
  
 

Join Date: Sep 2006
Location: Mysore, India
Posts: 191
Can you please explain a bit what you are trying to achieve. What string are you searching in the passwd file?
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 07:26 PM.


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