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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

shell prog question

  • 11-05-2003 1: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