1

The following script(s) work fine if copy and pasted into the shell. However, when creating a script file and interpreting with BASH- it fails with error: "Syntax error:"(" unexpected. It appears the logical "!" (not) is not being interpreted.

'''

#!/bin/bash
for TARGETFOLDER in !(*Sidereal);
do cd $TARGETFOLDER;
echo "--->---> Processing" $TARGETFOLDER;
for FILTERFOLDER in *;
do cd $FILTERFOLDER;
echo "--->--->---> Processing" $TARGETFOLDER $FILTERFOLDER;
pp_prepare -keep_wcs *r.fits;
pp_photometry -snr 3 -minarea 12 -aprad 6 *r.fits;
pp_calibrate -instrumental *r.fits;
cd ..;
done;
cd ..;
done;

'''

Is there a way to have this interpreted correctly- or maybe rewritten to conform to an interpreter? The original script as given was not formatted nicely... sorry thanks

Charles Duffy
  • 280,126
  • 43
  • 390
  • 441
ngc1535
  • 35
  • 5

1 Answers1

1

You need to explicitly enable extended glob support.

shopt -s extglob

for TARGETFOLDER in !(*Sidereal);

   ...
chepner
  • 497,756
  • 71
  • 530
  • 681