Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7787331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:37:50+00:00 2026-06-01T20:37:50+00:00

I have trying to run the below script to modify the timestamp in the

  • 0

I have trying to run the below script to modify the timestamp in the Growl plist but the script is unable to update the plist.
If I execute the same thing from the command line then it works fine.

Please help.

#!/bin/sh
current=`date +"%Y-%m-%d %l:%M:%S +0000"`
cmd="defaults read com.Growl.GrowlHelperApp LastUpdateCheck -date '$current'"
echo $cmd
`$cmd`
echo `defaults read com.Growl.GrowlHelperApp LastUpdateCheck`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:37:52+00:00Added an answer on June 1, 2026 at 8:37 pm

    Don’t put the command in a variable, the quoting doesn’t work the way you think it does (see BashFAQ #050: I’m trying to put a command in a variable, but the complex cases always fail!). (And BTW the echo $cmd is not telling you what command will actually be executed). Just run the command directly.

    Also, I presume you’re trying to run defaults write ..., not defaults read .... Finally, the echo and backquotes on the last line effectively cancel each other — just remove both. Here’s what I get:

    #!/bin/sh
    current=$(date +"%Y-%m-%d %l:%M:%S +0000")
    defaults write com.Growl.GrowlHelperApp LastUpdateCheck -date "$current"
    printf "New value of LastUpdateCheck: "
    defaults read com.Growl.GrowlHelperApp LastUpdateCheck
    

    If, for some reason, you actually do need to store the command in a variable before executing it, use an array. But note that this is a bash-only feature, so start the script with #!/bin/bash:

    #!/bin/bash
    current=$(date +"%Y-%m-%d %l:%M:%S +0000")
    cmd=(defaults write com.Growl.GrowlHelperApp LastUpdateCheck -date "$current")
    printf "About to execute:"
    printf " %q" "${cmd[@]}"  # Need to use printf trickery to get appropriate quoting
    printf "\n"
    "${cmd[@]}"
    printf "New value of LastUpdateCheck: "
    defaults read com.Growl.GrowlHelperApp LastUpdateCheck
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the below SQL Script which is run from Excel VBA using ADO
I am trying to run a script from within a script and have the
I am trying to run this update statement but informix doesn't allow me to.
I have this problem when trying to run hello world program using android SDK.
Trying to run my program in FreeBSD OS, I have the following results: $
I have two very similar programs each trying to run two threads OddThread and
I have a map reduce job I am trying to run on a relatively
I'm trying to run ActiveMQ on Mac OSX 10.5.7. I have Java version 1.5.0_19
I am trying to run jquery through a rails app. I have the edit
I am trying to run CUDA codes on my computer. I dont have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.