Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Unix shell script needed

Options
  • 19-11-2008 5:52pm
    #1
    Closed Accounts Posts: 93 ✭✭


    Hi,

    I need a shell program that will prompt the user to input a dept name to the script.
    The script should then check a specific directory called ‘report’ in the home directory of each member of that dept.
    If the report directory does not exist, or there are no contents in the directory, that user's name should be stored in a file called ‘logfile’ in the current directory. The first line in logfile should contain a header ‘List of users with no reports on ‘today’s date and time’ ‘
    Otherwise the contents of the directory should be copied to a sub directory called ‘reporting’ in the current directory.
    The script should repeat the process until all users in the dept have been checked.

    Any ideas?

    Thanks,
    Johnny


Comments

  • Registered Users Posts: 1,996 ✭✭✭lynchie


    Suggest you read the charter. Nobody is going to do your homework.

    If you want help, post up your code and people may try and point you at your errors.


  • Registered Users Posts: 2,694 ✭✭✭Dingatron


    REM shell program that will prompt the user to input a dept name to the script.
    REM The script should then check a specific directory called ‘report’ in the 
    REM home directory of each member of that dept.
    REM If the report directory does not exist, or there are no contents in the 
    REM directory, that user's name should be stored in a file called ‘logfile’ in the REM current directory. The first line in logfile should contain a header ‘List of REM users with no reports on ‘today’s date and time’ ‘
    REM Otherwise the contents of the directory should be copied to a sub 
    REM directory called ‘reporting’ in the current directory.
    REM The script should repeat the process until all users in the dept have been REM checked.*************************************************
    

    Here's a start any way. :pac:


  • Registered Users Posts: 2,534 ✭✭✭FruitLover


    Any ideas?

    Yeah: write (or at least attempt) a script that does the things that you outline above.


  • Registered Users Posts: 26,579 ✭✭✭✭Creamy Goodness


    Dingatron wrote: »
    REM shell program that will prompt the user to input a dept name to the script.
    REM The script should then check a specific directory called ‘report’ in the 
    REM home directory of each member of that dept.
    REM If the report directory does not exist, or there are no contents in the 
    REM directory, that user's name should be stored in a file called ‘logfile’ in the REM current directory. The first line in logfile should contain a header ‘List of REM users with no reports on ‘today’s date and time’ ‘
    REM Otherwise the contents of the directory should be copied to a sub 
    REM directory called ‘reporting’ in the current directory.
    REM The script should repeat the process until all users in the dept have been REM checked.*************************************************
    

    Here's a start any way. :pac:
    you forgot that shells don't use the keyword directory. they use folder instead.


  • Registered Users Posts: 2,694 ✭✭✭Dingatron


    Never said the logic was right. Copy and paste which I think op is looking for. :p


  • Advertisement
  • Registered Users Posts: 868 ✭✭✭brianmc


    #Checking if directory reports exists, if it does, copy contents to a folder called reporting in the current dir

    if [ -d /$user/reports ]
    then >> ./reporting exists

    #if it doesn't copy the user's name to a file in the current dir called logfile

    else >> ./logfile

    fi

    Hmmm... I wrote a shell script for another user on here a few months ago that sounds almost identical to that.

    Makes me wonder.

    Anyhow, do a search, it shouldn't be too hard to find it.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Johnny Volume = Permaban


Advertisement