Skip to content

Commit

Permalink
SC2006: Use $(..) instead of legacy ...
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored and nyalldawson committed May 31, 2018
1 parent 408a9fb commit 09f17d9
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .ci/travis/linux/docker-build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ echo "travis_fold:end:cmake"
# Hopefully clocks are in sync :)
TRAVIS_TIME=120
UPLOAD_TIME=5
CURRENT_TIME=`date +%s`
CURRENT_TIME=$(date +%s)
TIMEOUT=$(expr \( ${TRAVIS_TIME} - ${UPLOAD_TIME} \) \* 60 - ${CURRENT_TIME} + ${TRAVIS_TIMESTAMP})
TIMEOUT=$(( ${TIMEOUT} < 300 ? 300 : ${TIMEOUT} ))
echo "Timeout: ${TIMEOUT}s (started at ${TRAVIS_TIMESTAMP}, current: ${CURRENT_TIME})"
Expand Down Expand Up @@ -107,7 +107,7 @@ popd > /dev/null # /root/QGIS
###########
# Run tests
###########
CURRENT_TIME=`date +%s`
CURRENT_TIME=$(date +%s)
TIMEOUT=$(expr \( ${TRAVIS_TIME} - ${UPLOAD_TIME} \) \* 60 - ${CURRENT_TIME} + ${TRAVIS_TIMESTAMP})
echo "Timeout: ${TIMEOUT}s (started at ${TRAVIS_TIMESTAMP}, current: ${CURRENT_TIME})"
timeout ${TIMEOUT}s python3 /root/QGIS/.ci/travis/scripts/ctest2travis.py xvfb-run ctest -V -E "$(cat /root/QGIS/.ci/travis/linux/blacklist.txt | sed -r '/^(#.*?)?$/d' | paste -sd '|' -)" -S /root/QGIS/.ci/travis/travis.ctest --output-on-failure
Expand Down
4 changes: 2 additions & 2 deletions scripts/astyle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fi

min_version="3"
astyle_version_check() {
[ `printf "$($1 --version 2>&1 | cut -d ' ' -f4)\n$min_version" | sort -${SV} | head -n1` = "$min_version" ]
[ $(printf "$($1 --version 2>&1 | cut -d ' ' -f4)\n$min_version" | sort -${SV} | head -n1) = "$min_version" ]
}

for ASTYLE in ${QGISSTYLE} $(dirname $0)/qgisstyle $(dirname $0)/RelWithDebInfo/qgisstyle astyle
Expand Down Expand Up @@ -122,7 +122,7 @@ for f in "$@"; do
continue
fi

if [[ -f $f && `head -c 3 $f` == $'\xef\xbb\xbf' ]]; then
if [[ -f $f && $(head -c 3 $f) == $'\xef\xbb\xbf' ]]; then
mv $f $f.bom
tail -c +4 $f.bom > $f
echo "removed BOM from $f"
Expand Down
4 changes: 2 additions & 2 deletions scripts/create-transifex-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# TODO: update script to consider qgis_sr@latin and qgis_zh-Han*

LOCALES=`ls i18n/qgis_*.ts| grep -o "qgis_[a-z\_A-Z]*" | sed 's/qgis_//g' | sort | uniq`
LOCALES=$(ls i18n/qgis_*.ts| grep -o "qgis_[a-z\_A-Z]*" | sed 's/qgis_//g' | sort | uniq)

TSFILE='i18n/qgis_en.ts'
RESOURCE='i18n/qgis_<lang>.ts'
Expand All @@ -40,7 +40,7 @@ tx set -t QT --minimum-perc=35 --auto-local -r QGIS.qgis-application \

for LOCALE in $LOCALES
do
LOCALEFILE=`echo $TSFILE | sed "s/\_en/\_$LOCALE/g"`
LOCALEFILE=$(echo $TSFILE | sed "s/\_en/\_$LOCALE/g")
tx set -r QGIS.qgis-application -l $LOCALE "$LOCALEFILE"
done

Expand Down
8 changes: 4 additions & 4 deletions scripts/customwidget_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ set -e

CLASSNAME=$1

TODAY=`date '+%d.%m.%Y'`
YEAR=`date '+%Y'`
TODAY=$(date '+%d.%m.%Y')
YEAR=$(date '+%Y')

AUTHOR=`git config user.name`
EMAIL=`git config user.email`
AUTHOR=$(git config user.name)
EMAIL=$(git config user.email)

CLASSUPPER="${CLASSNAME^^}"
CLASSLOWER="${CLASSNAME,,}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/jenkins-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ make Experimental || true
#TRES=0
#ctest -T test --no-compress-output || true
if [ -f Testing/TAG ] ; then
xsltproc ../tests/ctest2junix.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > CTestResults.xml
xsltproc ../tests/ctest2junix.xsl Testing/$(head -n 1 < Testing/TAG)/Test.xml > CTestResults.xml
fi
42 changes: 21 additions & 21 deletions scripts/qgis_srs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#
# 1.0.3: Minor cosmetics in comments.
#
# 1.0.2: Replace 'latlon' and 'lonlat' in the `proj -le` output, so that QGIS
# 1.0.2: Replace 'latlon' and 'lonlat' in the $(proj -le) output, so that QGIS
# can parse the 'tbl_projection' table to provide the GCSs list in the
# 'Projection' dialog (BTW, the dialog should be called 'Coordinate
# system' actually, as a projection is only a component of a cs).
Expand Down Expand Up @@ -129,15 +129,15 @@ pop_tbl_projs ()

# Process each proj4 projection acronym...

for i in `proj -l | cut -d" " -f1 | sed -e 's/lonlat/longlat/' -e 's/latlon/latlong/'` ; do
for i in $(proj -l | cut -d" " -f1 | sed -e 's/lonlat/longlat/' -e 's/latlon/latlong/') ; do

#...to extract it's parameters, making sure not more than 4 fields are created...

proj=`proj -l=$i | tr -d "\t" | sed 's/^ *//g' | sed 's/ : /\n/' | sed "s/'/''/g" | awk '{print "'\''"$0"'\''"}' | tr "\n" "," | sed 's/,$/\n/' | sed "s/','/ /4g"`
proj=$(proj -l=$i | tr -d "\t" | sed 's/^ *//g' | sed 's/ : /\n/' | sed "s/'/''/g" | awk '{print "'\''"$0"'\''"}' | tr "\n" "," | sed 's/,$/\n/' | sed "s/','/ /4g")

#...count the number of parameters...

proj_nf=`echo $proj | awk -F"','" '{print NF}'`
proj_nf=$(echo $proj | awk -F"','" '{print NF}')

#...if only 3 (3 or 4 are possible) add an empty 4th one.

Expand Down Expand Up @@ -189,24 +189,24 @@ pop_tbl_srss ()
{
# Populate SRSs table:

gdal_share=`gdal-config --datadir`
gdal_share=$(gdal-config --datadir)
no=0

# Extract projected SRSs from the installed GDAL pcs.csv file:

#Find valid EPSG numbers parsing GDAL's pcs.csv:
for i in `awk 'NR>1' ${gdal_share}/pcs.csv | cut -d, -f1`; do
for i in $(awk 'NR>1' ${gdal_share}/pcs.csv | cut -d, -f1); do

raw=`epsg_tr.py -proj4 $i 2>&1 | tr "\n" " " | sed 's/ <> $//' | grep -v "^ERROR 6: "`
raw=$(epsg_tr.py -proj4 $i 2>&1 | tr "\n" " " | sed 's/ <> $//' | grep -v "^ERROR 6: ")

if [ -n "$raw" ]; then

no=`expr $no + 1`
name=`echo $raw | sed 's/^# //' | grep -o "^.\{1,\} <[[:digit:]]\{1,\}>" | sed 's/ <[[:digit:]]\{1,\}>//' | sed "s/'/''/g"`
proj=`echo $raw | grep -o "+proj=[^[:space:]]\{1,\}" | cut -d"=" -f2`
ellps=`echo $raw | grep -o "+ellps=[^[:space:]]\{1,\}" | cut -d"=" -f2`
srs=`echo $raw | grep -o "+proj.\{1,\} +no_defs"`
epsg=`echo $raw | grep -o ' <[[:digit:]]\{1,\}> ' | sed 's/[^[:digit:]]//g'`
no=$(expr $no + 1)
name=$(echo $raw | sed 's/^# //' | grep -o "^.\{1,\} <[[:digit:]]\{1,\}>" | sed 's/ <[[:digit:]]\{1,\}>//' | sed "s/'/''/g")
proj=$(echo $raw | grep -o "+proj=[^[:space:]]\{1,\}" | cut -d"=" -f2)
ellps=$(echo $raw | grep -o "+ellps=[^[:space:]]\{1,\}" | cut -d"=" -f2)
srs=$(echo $raw | grep -o "+proj.\{1,\} +no_defs")
epsg=$(echo $raw | grep -o ' <[[:digit:]]\{1,\}> ' | sed 's/[^[:digit:]]//g')
isgeo=0

echo "INSERT INTO tbl_srs VALUES(${no},'${name}','${proj}','${ellps}','${srs}',${epsg},${epsg},${isgeo});"
Expand All @@ -218,18 +218,18 @@ done
# Extract un-projected SRSs from the installed GDAL gcs.csv file:

#Find valid EPSG numbers parsing GDAL's gcs.csv:
for i in `awk 'NR>1' ${gdal_share}/gcs.csv | cut -d, -f1`; do
for i in $(awk 'NR>1' ${gdal_share}/gcs.csv | cut -d, -f1); do

raw=`epsg_tr.py -proj4 $i 2>&1 | tr "\n" " " | sed 's/ <> $//' | grep -v "^ERROR 6: "`
raw=$(epsg_tr.py -proj4 $i 2>&1 | tr "\n" " " | sed 's/ <> $//' | grep -v "^ERROR 6: ")

if [ -n "$raw" ]; then

no=`expr $no + 1`
name=`echo $raw | sed 's/^# //' | grep -o "^.\{1,\} <[[:digit:]]\{1,\}>" | sed 's/ <[[:digit:]]\{1,\}>//' | sed "s/'/''/g"`
proj=`echo $raw | grep -o "+proj=[^[:space:]]\{1,\}" | cut -d"=" -f2`
ellps=`echo $raw | grep -o "+ellps=[^[:space:]]\{1,\}" | cut -d"=" -f2`
srs=`echo $raw | grep -o "+proj.\{1,\} +no_defs"`
epsg=`echo $raw | grep -o ' <[[:digit:]]\{1,\}> ' | sed 's/[^[:digit:]]//g'`
no=$(expr $no + 1)
name=$(echo $raw | sed 's/^# //' | grep -o "^.\{1,\} <[[:digit:]]\{1,\}>" | sed 's/ <[[:digit:]]\{1,\}>//' | sed "s/'/''/g")
proj=$(echo $raw | grep -o "+proj=[^[:space:]]\{1,\}" | cut -d"=" -f2)
ellps=$(echo $raw | grep -o "+ellps=[^[:space:]]\{1,\}" | cut -d"=" -f2)
srs=$(echo $raw | grep -o "+proj.\{1,\} +no_defs")
epsg=$(echo $raw | grep -o ' <[[:digit:]]\{1,\}> ' | sed 's/[^[:digit:]]//g')
isgeo=1

echo "INSERT INTO tbl_srs VALUES(${no},'${name}','${proj}','${ellps}','${srs}',${epsg},${epsg},${isgeo});"
Expand Down
2 changes: 1 addition & 1 deletion scripts/rename_class.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if [[ ${FILEPATH:(-1)} = "/" ]]; then
PATH="${FILEPATH::-1}"
fi

FILES=`git ls-tree --name-only -r HEAD | grep ".*\.\(sip\|cpp\|h\|txt\)$"`
FILES=$(git ls-tree --name-only -r HEAD | grep ".*\.\(sip\|cpp\|h\|txt\)$")

for f in $FILES
do
Expand Down
6 changes: 3 additions & 3 deletions scripts/sip_include.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ for module in "${modules[@]}"; do
continue
fi
if ! egrep -xq '^(#define +)?SIP_NO_FILE' src/${module}/${header}; then
sip=`${GP}sed -r 's/(.*)\.h$/\1.sip/' <<< ${header}`
if_cond=`egrep -x '^(#define +)?SIP_IF_MODULE\((.*)\)$' src/${module}/${header} | \
${GP}sed -r -e 's/(#define +)?SIP_IF_MODULE\((.*)\)/%If (\2)/'`
sip=$(${GP}sed -r 's/(.*)\.h$/\1.sip/' <<< ${header})
if_cond=$(egrep -x '^(#define +)?SIP_IF_MODULE\((.*)\)$' src/${module}/${header} | \
${GP}sed -r -e 's/(#define +)?SIP_IF_MODULE\((.*)\)/%If (\2)/')
if [[ ! -z $if_cond ]]; then
echo "$if_cond" >> $file
fi
Expand Down

0 comments on commit 09f17d9

Please sign in to comment.