Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, I am very new to this and would like some help with a script that I have been tasked to analyze. function process() { 6: sleep "$1" 7: echo ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2012
    Posts
    7

    help with understanding and manipulating a script


    Hello, I am very new to this and would like some help with a script that I have been tasked to analyze.

    function process() {
    6: sleep "$1"
    7: echo -n "$1 "
    8: }
    9:
    10: for data in $*; do
    11: process "$data" &
    12: done
    13: wait
    14: echo
    15:
    16: exit 0

    these are the questions asked of me


    What is this script doing?


    How is it doing this?


    Comment the script and include your updated code below


    Adjust the script to output each value on a line by itself, include it below


    If you wanted to reverse the order of processing, how might you do it?

    can somebody please help I am really struggling with linux!

  2. #2
    Administrator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,864
    Hi there and welcome to the forums.
    This looks like school work, which is against forum rules. I'll allow it to remain open if you can convince me it isn't school work.
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

    I'd rather be lost at the lake than found at home.

  3. #3
    Administrator jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    5,026
    Hi there!
    I'm not a scripting guy... I'm happy to have done a few minor bash scripts for my own needs.
    But like Mike said, we won't do homework... but if you post what you have tried and any errors that you've had, someone here may be able to point you in the right direction.
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to private messages asking for Linux help. Please keep it on the public boards.

  4. $spacer_open
    $spacer_close

Posting Permissions

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