#1  
Old 29th August 2011, 05:52
abood1190 abood1190 is offline
Junior Member
 
Join Date: Aug 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default question in shell script

Hell guys,
I need a little help to solve this question

Write a Bourne shell script which:
• Has one command line argument.
• If the command line argument is a directory then the script should output the number of files in the directory.
• If the command line argument is an ordinary file then the script should output whether or not the file has execute permission for the file owner.
• If the command line argument is neither a file or directory then the script should output an appropriate error message.
• If no command line argument is supplied then the script should output an appropriate error message.
Reply With Quote
Sponsored Links
  #2  
Old 29th August 2011, 13:04
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 34,586
Thanks: 792
Thanked 4,983 Times in 3,903 Posts
Default

You might want to take a look here first:

http://tldp.org/LDP/abs/html/

If you wrote your execise script then and some parts of it wont work and you are unable to find the problem yourself, then post your script.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 1st September 2011, 01:39
abood1190 abood1190 is offline
Junior Member
 
Join Date: Aug 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by till View Post
You might want to take a look here first:

http://tldp.org/LDP/abs/html/

If you wrote your execise script then and some parts of it wont work and you are unable to find the problem yourself, then post your script.
this is my code
Code:
#!/bin/sh

echo " Command line argument is :" $1

if [ -d $1 ]
then
echo " The number of files in the directory is ` ls -l | wc -l` "
else
echo " It is not a dirctory "
fi

if [ -f $1 ]
then
echo " The execute permission for the file owner is ` ls -l $1`"
else
echo " There is no execute permission "
fi
the code might be wrong !!
the time for submission is up !
Thank you
Reply With Quote
  #4  
Old 2nd September 2011, 16:01
id10t id10t is offline
Senior Member
 
Join Date: Nov 2008
Posts: 237
Thanks: 2
Thanked 22 Times in 22 Posts
 
Default

Smells like homework anyway...
__________________
I'm a very happy linode.com customer, I'm sure you will be too!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot login to phpmyadmin penkku HOWTO-Related Questions 1 24th February 2011 09:26
freebsd 7, samba 3, domain controller alexdimarco Suggest HOWTO 6 5th November 2010 16:54
Help with Shell Script Needed infinity2030 Programming/Scripts 2 7th March 2009 21:04
Shell Script Execution Problem giganet Programming/Scripts 1 23rd December 2008 15:04
Please explain me this shell script. i.linus Programming/Scripts 1 13th September 2008 03:31


All times are GMT +2. The time now is 07:00.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.