Results 1 to 3 of 3

Thread: Novice in bash scripting needs help

  1. #1
    Join Date
    Sep 2010
    Beans
    2

    Post Novice in bash scripting needs help

    Hello! I am novice in Linux and bash scripting and need a little help in bash scripting. My version of Linux is 10.04 and bash ver. 4.1.5

    So, I got this hometask from my university:

    1) Create variable $hil amd store this string in it "Data files stored at ~/data"
    Output its content on screen, then show first 6 symbols of it.

    2) Add "Access granted (for user)" to the end of $hil.
    Output it and exchange every letter "t" to "%%".

    3) Write a command that will show "Yes" or "No" depending on if file "/proc/bus" is empty or not.

    4) Show the the last line of file with extension .h from "/usr/include/linux" that begins with the word "If".

    5) Write line 14 of file /usr/include/asm/errno.h in to the variable hl_2.


    I have managed to do this:
    Code:
    hil="Data files stored at ~/data"
    echo ${hil:1:6}
    hil=${hil}"Access granted (for user)"
    echo $hil
    echo ${hill/t/%%}
    So, i have managed to make first 2 tasks.

    Please help me with the other 3. And, if possible, describe why this operator or that, so I will really learn something and not just Ctrl+C + Ctrl+V it in my *.sh file

  2. #2
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: Novice in bash scripting needs help

    Hi and welcome to the forums!

    Check out: Posting Homework Problems

    and
    Code:
    man bash | less +/^"CONDITIONAL EXPRESSIONS"
    man bash | less +/"Pipelines"
    man tail
    man head
    man grep

  3. #3

    Re: Novice in bash scripting needs help

    Homework - Thread Closed.

    From the Code of Conduct:

    Ubuntu Forums should not be thought of as a homework service. Please do not post your homework assignments expecting someone else to do it for you.

Tags for this Thread

Bookmarks

Posting Permissions

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