Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

shell prog question

  • 11-05-2003 02:57PM
    #1
    Closed Accounts Posts: 85 ✭✭


    Hi,
    I'm trying to get the date command to work int he following format:
    date -d '1970-01-01 56700 seconds'

    but when I try to insert a command line argument instead of 56700 I run into problems...I've tried everything that I can possibly think of and heres my latest attempt:

    temp="'1970-01-01 $1 seconds'"
    dateStatement="date -d ${temp}"
    dateresult=`${dateStatement}`

    And the result:
    date: too many non-option arguments: seconds'
    Try `date --help' for more information.

    If anyone could help I'd be eternally greatful...'cos knowing my luck it'll appear in my end of year exam tomorrow!

    Thanks.
    :)


Comments

  • Moderators, Social & Fun Moderators Posts: 10,501 Mod ✭✭✭✭ecksor


    I think you want

    dateStatement="date -d '${temp}'"

    So the single quotes get passed to the final command in the backquotes.


Advertisement