I'm not sure, but
it looks like the apostrophies get in the way.
try:
awk -f":" '/'$username'/ { print $6 }' passwd.bak >output
I hope that works.
--- In geeksthatgawk@yahoogroups.com, renuka prasad
<renukaprasadtg@y...> wrote:
>
> Hi All,
>
> I need a help from u.I'm getting the home directory
> from passwd.bak file.I need to find the disk usage of
> that particular user.I'm getting output if i directly
> substitue variable $username with exact username.But
> i'm not getting output when i use in shell script.The
> contents is as follows:
>
> ---------------------------------------------------------------------
> # Script for displaying diskusage based on user name
> # Only username to be supplied by user
> echo "\n Please enter the username:\c"
> read username
> awk -F":" '/$username/ { print $6 }' passwd.bak >
> output
> echo " Home Directory Of $username "
> cat output
> echo " Disk Usage in KB:"
> sudo du -sk < output
> ----------------------------------------------------------------------
> I really appreciate any kind of help on this.Thanks
> in advance.
>
> Regards,
> Prasad
>
>
>
>
> __________________________________
> Yahoo! for Good - Make a difference this year.
> http://brand.yahoo.com/cybergivingweek2005/
>