diode Posted March 27, 2007 Share Posted March 27, 2007 Hello, I'm trying to make a script in which I want to use variables to store the output of: date +%m as well as date +%d and date +%Y. Basically what the goal is, is I want/need to learn how to store the output of commands in variables in shell scripts. Nothing I try works. I am going to have a cron job execute at 12:00 am every day. The cron job will execute a batch file which in turn executes a mysql script. I have a message board, and I want everyone's board points to increase by 1 if they have posted during the day that just ended. I'm going to have a special table that contains their userid and 3 integer fields for month, day, and year for the date they posted. I need mysql to query this table every day at 12:00 am. I need mysql to query this table and return every record for the previous day, such as current date minus one. The reason I want it to do arithmetic to find if they posted during the previous day is because if I merely add a record to this table when they post for the first time during a day, and automatically update a user's points total if a record containing their userid was found, somebody could possibly post a message like at 12:01 am or something BEFORE the query is done running, and either update this person who posted during the day AFTER the one I am checking for, or actually delete this entry if the person posted after the update query, and before the query that will delete all the users' records for the previous day, thereby treating it as if they had posted during the previous day. Then their record would be gone in the table, and if they don't post again for that day, their points wouldn't get updated during the next cron job. It's difficult to explain, but the explanation is more difficult than the concept actually is. If anyone could provide help, or simple scripts to show me how this is done, I'd greatly appreciate it. I know it can't be that difficult really, but sometimes little things are more annoying and elusive than bigger things. Thanks again in advance, diode Quote Link to comment Share on other sites More sharing options...
fenway Posted April 4, 2007 Share Posted April 4, 2007 I'm not really sure what you're trying to achieve, or why you need variables for this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.