Skip to content

Commit

Permalink
Use [[]] instead of [] as bash prefers the double square bracket
Browse files Browse the repository at this point in the history
  • Loading branch information
weihuang-jedi committed Aug 29, 2024
1 parent 650ce7b commit a06f8d2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/exglobal_atmos_products.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ for (( nset=1 ; nset <= downset ; nset++ )); do

echo "!prod_dir: ${!prod_dir}"
bucket_dir="BUCKET_ATMOS_GRIB_${grid}"
if [ -z ${!bucket_dir+x} ]; then
if [[ -z ${!bucket_dir+x} ]]; then
echo "!bucket_dir is unset"
else
echo "!bucket_dir is set to: ${!bucket_dir}"
if [ "${!prod_dir}" != "${!bucket_dir}" ]; then
if [[ "${!prod_dir}" != "${!bucket_dir}" ]]; then
cp "pgb2${grp}file_${fhr3}_${grid}" "${!bucket_dir}/${PREFIX}pgrb2${grp}.${grid}.${fhr3}"
cp "${!prod_dir}/${PREFIX}pgrb2${grp}.${grid}.${fhr3}.idx" "${!bucket_dir}/${PREFIX}pgrb2${grp}.${grid}.${fhr3}.idx"
fi
Expand Down Expand Up @@ -210,11 +210,11 @@ if [[ "${FLXGF:-}" == "YES" ]]; then

echo "!prod_dir: ${!prod_dir}"
bucket_dir="BUCKET_ATMOS_GRIB_${grid}"
if [ -z ${!bucket_dir+x} ]; then
if [[ -z ${!bucket_dir+x} ]]; then
echo "!bucket_dir is unset"
else
echo "!bucket_dir is set to: ${!bucket_dir}"
if [ "${!prod_dir}" != "${!bucket_dir}" ]; then
if [[ "${!prod_dir}" != "${!bucket_dir}" ]]; then
cp "sflux_${fhr3}_${grid}" "${!bucket_dir}/${PREFIX}flux.${grid}.${fhr3}"
cp "${!prod_dir}/${PREFIX}flux.${grid}.${fhr3}.idx" "${!bucket_dir}/${PREFIX}flux.${grid}.${fhr3}.idx"
fi
Expand Down

0 comments on commit a06f8d2

Please sign in to comment.