Find the answer to your Linux question:
Results 1 to 2 of 2
Write a Bash shell script that receives only one argument via command line. (Ensure that the argument must be exactly one and it must be a directory which is owned ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2010
    Posts
    1

    need help in question !!!


    Write a Bash shell script that receives only one argument via command line. (Ensure that the argument must be exactly one and it must be a directory which is owned by you. If not the script exits). The script should display the number of readable, writable and executable files in that directory.

    For the question written above please recommend me any solution .... i have written a code but its not giving me valid output .. u can also see my code below :

    #!/bin/bash

    read=0
    write=0
    exec=0

    if [ $# -eq 1 -a -d "$1" ]
    then

    ls $1 > perm
    for var in $( cat perm )
    do

    if [ -r "$var" ]
    then

    read=`expr $read + 1`

    fi
    done
    else
    echo "Error"

    this is just for checking the readable ..... rest of other are like the same ....

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Hi and Welcome !

    We can't help you in Homework questions/assignments. Its against Forum Rules.
    I would suggest you go through a few bash tutorials. Don't hesitate to start a new thread if you have any specific problem.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •