![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| scripting newbie needs help | irishluck66 | Shell Programming and Scripting | 0 | 05-23-2008 12:22 PM |
| Shell Scripting Newbie | mattyjim2 | UNIX for Dummies Questions & Answers | 1 | 10-11-2007 07:20 AM |
| Shell scripting newbie - please be gentle. | charliemp3 | Shell Programming and Scripting | 2 | 08-01-2007 02:25 PM |
| shell scripting newbie question | jazzman | UNIX for Dummies Questions & Answers | 2 | 12-29-2006 09:33 AM |
| Newbie - Need help in bash scripting | coolbib | Shell Programming and Scripting | 4 | 08-11-2002 09:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Scripting Newbie
Seems simple but I am having difficulty with this one: I am trying to write a single command line argument (which will be a path) - the program should print out the owner of the path.
I can not get anything I write to run. Please help. |
|
||||
|
Quote:
Sorry, could you please be more descriptive. To find the owner of the path. -- path could either be a file or a directory. Did you mean finding the owner of the file or a directory ? |
|
||||
|
Yes, find owner of file or directory to print that information out once the script is run. I know the command to get the information, I am having difficulty writing the command within a script for a user to supply a file/directory to get that information.
|
|
||||
|
Code:
#! /bin/zsh
if [ $# -eq 0 ]
then
echo "USAGE: script file/directory"
exit 1
fi
if [ -f $1 ]
then
echo "Owner of $1 : `ls -l $1 | awk '{ print $3 }'`"
else
echo "Owner of $1 : `ls -ld $1 | awk '{ print $3 }'`"
fi
exit 0
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|