The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 03-17-2009
GoldenEye4ever GoldenEye4ever is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 5
Thanks a lot cfajohnson,
you rule

But now I have another question

I've got my attributes evaluated, however I need to consider if multiple attributes are passed through, as a single string

Basically, I need to tokenize the parameters string

This is what I have so far:

Code:
...
evalParams()
{
  output=""
  input="$1"
  set -A attr $(echo ${input} | tr ',' ' ' )
  
  n="0"
  while [ "${n}" -lt "${#attr[*]}" ];
  do
    eval "p=${attr[${n}]}"
    output="${output} ${p}"
    n=`expr $n + 1`
  done
  
  echo ${output}
}
...
## this is actually loaded from file, but for the purpose of an example it's fine :)
parameters="`date +%m%d`,`date +%H%M`"
...
params=`evalParams ${parameters}`

Unfortunately, it isn't working
The attr array isn't being populated as I expected,
the entrie parameter string just gets assigned to the 1st index (index 0)



As for cronjobs, we're trying to get our scheduling in the DB.
- We want our schedules to be centralized
- Makes learning the timings of the batch easier

Last edited by GoldenEye4ever; 03-18-2009 at 12:50 AM..