shell script problem (urgent)

Discussion in 'Programming/Scripts' started by selvam, Jul 25, 2006.

  1. selvam

    selvam New Member

    hi,

    if any one give me a code for this output


    if i give input 4 means

    i want this output


    *
    * *
    * * *
    * * * *​

    actually i am not familier with for loop in shell script .

    so that i ask this help to u

    send your answer as soon as possible

    thanks
     
  2. falko

    falko Super Moderator Howtoforge Staff

  3. KenJackson

    KenJackson New Member

    I implemented this just for fun. But this sounds so much like a homework assignment that I'm only posting a few lines (the looping part) of my solution.
    Code:
    #!/bin/sh
    ...
    while [ $n -gt 0 ]; do
        ...
        n=$[n-1]
    done
    Don't forget to make the file executable with 'chmod +x scriptfile'.
     

Share This Page