Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

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

    Hello !!
    I'm trying to run this small shell script
    tom:~> cat -n
    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 ???

  2. #2
    works for me, fedora 15 64bit, try your test again. chmod +x your script and run it as: ./

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

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

  3. #3
    thank you
    but it didnot work for me
    actaully am using centOS

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

  6. #5
    Confirmed it works on my CentOS 5.x box.

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

    /bin/bash ./
    How about like this?

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

  7. #6
    Still not working guys>>>
    what to please

  8. #7
    Try this:

    at the top of your script, right below the #!/bin/bash line, put:
    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
    Tucson AZ
    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
    Here is the script
    set -x 
    echo "this is the ,'date'"
    this is the output
    ++ echo 'this the ,'\''date'\'' ' 
    this is the,'date'

  11. #10
    and this is without set -x
    echo "this is the,'date' "
    this is the output
    this is the ,'date'
    thanks once again
    waiting for you Pro

Posting Permissions

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