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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Unix shell script needed

  • 19-11-2008 4: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, Registered Users 2 Posts: 2,013 ✭✭✭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, Registered Users 2 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, Registered Users 2 Posts: 2,534 ✭✭✭FruitLover


    Any ideas?

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


  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭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, Registered Users 2 Posts: 2,694 ✭✭✭Dingatron


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


  • Advertisement
  • Registered Users, Registered Users 2 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, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Johnny Volume = Permaban


Advertisement