You are not logged in.
So I created a bash script which executes at random one PHP script in a directory,
scripts=(
flag_videos_which_need_grabbing.php
grab_video.php
grab_speaker_image.php
);
php -f /home/rt_cron/${scripts[$((RANDOM%${#scripts[*]}))]} > /dev/null 2>&1;
However, because I change the PHP scripts in that directory frequently I'd like this bash script to actually create its 'scripts' array from the current contents of the /home/rt_cron directory. Basically I need something like this,
scripts = $(ls /home/rt_cron/*.php)
Any ideas anyone?
Last edited by tony5429 (2010-02-10 03:32:35)
Offline
Well just minutes after posting that I found a solution with awk,
scripts=($(ls /home/rt_cron/*.php | awk -F" " '{$1=$1; print}'));
Offline
scripts=(`ls /home/rt_cron/*.php`)
Methinks.
Well just minutes after posting that I found a solution with awk,
scripts=($(ls /home/rt_cron/*.php | awk -F" " '{$1=$1; print}'));
You don't need that awk in there at all.
Last edited by Peasantoid (2010-02-10 03:32:03)
Offline
Oh great; that's even better! Thanks, peasantoid!
Offline