Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
Like Tree1Likes
Hello !! I'm trying to run this small shell script Code: tom:~> cat -n mysystem.sh 8 echo "Today's date is `date`, this is week `date +"%V"`." 9 echo But the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2011
    Posts
    11

    Unhappy Simple problem face a beginner....HELP PLEASE


    Hello !!
    I'm trying to run this small shell script
    Code:
    tom:~> cat -n mysystem.sh
    8 echo "Today's date is `date`, this is week `date +"%V"`."
    9 echo
    But the when i run this,,,,,,here is the result:
    Today's date is `date`, this is week `date +"%V"`.

    What's wrong ???
    thanks

  2. #2
    Just Joined!
    Join Date
    Aug 2011
    Posts
    4
    works for me, fedora 15 64bit, try your test again. chmod +x your script and run it as: ./mysystem.sh

    Today's date is Mon Oct 24 06:59:32 EDT 2011, this is week 43.


    cat -n date.sh
    1 echo "Today's date is `date`, this is week `date +"%V"`."
    2 echo
    3

  3. #3
    Just Joined!
    Join Date
    Oct 2011
    Posts
    11
    thank you
    but it didnot work for me
    actaully am using centOS

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    When you type out the command and run it in the terminal, does it work?
    linux user # 503963

  6. #5
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Confirmed it works on my CentOS 5.x box.

    How are you running it? Have it tried it like:

    Code:
    /bin/bash ./mysystem.sh
    How about like this?

    Code:
    echo "Today's date is $(date), this is week $(date +%V)."

  7. #6
    Just Joined!
    Join Date
    Oct 2011
    Posts
    11
    Still not working guys>>>
    what to do.........help please

  8. #7
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Try this:

    at the top of your script, right below the #!/bin/bash line, put:
    Code:
    set -x
    Then run the script.

    Then post the entire contents of your script.

    Then post the entire contents of the script output.

    When you do the last two things, be sure to enclose the contents in the CODE brackets, for easier reading.

  9. #8
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    I'd suggest the OP, instead of saying "that didn't work", post the actual commands s/he uses as well as the output. It seems to work for everyone else?

  10. #9
    Just Joined!
    Join Date
    Oct 2011
    Posts
    11
    Here is the script
    Code:
    #!bin/bash 
    set -x 
    echo "this is the ,'date'"
    this is the output
    Code:
    ++ echo 'this the ,'\''date'\'' ' 
    this is the,'date'
    thanks

  11. #10
    Just Joined!
    Join Date
    Oct 2011
    Posts
    11
    and this is without set -x
    Code:
    #!/bin/bash 
    echo "this is the,'date' "
    this is the output
    Code:
    this is the ,'date'
    thanks once again
    waiting for you Pro

Page 1 of 2 1 2 LastLast

Posting Permissions

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