I'm trying to get the contents of my crontab into a bash array with the following code
Code:
crontab -l > /home/test/cron.tmp
declare -a crons
exec 0</home/test/cron.tmp
while read line
do
crons($line)
done
echo ${crons[@]} 1> /home/test/out.tmp
The problem I'm having, is whenever the script comes across a '*' in the cron file, it echos the contents of the current directory instead of echoing a '*'.
Any idea what I'm doing wrong?
Thanks