Skip to content

Commit 09f17d9

Browse files
m-kuhnnyalldawson
authored andcommitted
SC2006: Use $(..) instead of legacy ...
1 parent 408a9fb commit 09f17d9

File tree

8 files changed

+36
-36
lines changed

8 files changed

+36
-36
lines changed

.ci/travis/linux/docker-build-test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ echo "travis_fold:end:cmake"
7070
# Hopefully clocks are in sync :)
7171
TRAVIS_TIME=120
7272
UPLOAD_TIME=5
73-
CURRENT_TIME=`date +%s`
73+
CURRENT_TIME=$(date +%s)
7474
TIMEOUT=$(expr \( ${TRAVIS_TIME} - ${UPLOAD_TIME} \) \* 60 - ${CURRENT_TIME} + ${TRAVIS_TIMESTAMP})
7575
TIMEOUT=$(( ${TIMEOUT} < 300 ? 300 : ${TIMEOUT} ))
7676
echo "Timeout: ${TIMEOUT}s (started at ${TRAVIS_TIMESTAMP}, current: ${CURRENT_TIME})"
@@ -107,7 +107,7 @@ popd > /dev/null # /root/QGIS
107107
###########
108108
# Run tests
109109
###########
110-
CURRENT_TIME=`date +%s`
110+
CURRENT_TIME=$(date +%s)
111111
TIMEOUT=$(expr \( ${TRAVIS_TIME} - ${UPLOAD_TIME} \) \* 60 - ${CURRENT_TIME} + ${TRAVIS_TIMESTAMP})
112112
echo "Timeout: ${TIMEOUT}s (started at ${TRAVIS_TIMESTAMP}, current: ${CURRENT_TIME})"
113113
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

scripts/astyle.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fi
2222

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

2828
for ASTYLE in ${QGISSTYLE} $(dirname $0)/qgisstyle $(dirname $0)/RelWithDebInfo/qgisstyle astyle
@@ -122,7 +122,7 @@ for f in "$@"; do
122122
continue
123123
fi
124124

125-
if [[ -f $f && `head -c 3 $f` == $'\xef\xbb\xbf' ]]; then
125+
if [[ -f $f && $(head -c 3 $f) == $'\xef\xbb\xbf' ]]; then
126126
mv $f $f.bom
127127
tail -c +4 $f.bom > $f
128128
echo "removed BOM from $f"

scripts/create-transifex-resources.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

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

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

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

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

scripts/customwidget_create.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ set -e
1111

1212
CLASSNAME=$1
1313

14-
TODAY=`date '+%d.%m.%Y'`
15-
YEAR=`date '+%Y'`
14+
TODAY=$(date '+%d.%m.%Y')
15+
YEAR=$(date '+%Y')
1616

17-
AUTHOR=`git config user.name`
18-
EMAIL=`git config user.email`
17+
AUTHOR=$(git config user.name)
18+
EMAIL=$(git config user.email)
1919

2020
CLASSUPPER="${CLASSNAME^^}"
2121
CLASSLOWER="${CLASSNAME,,}"

scripts/jenkins-run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ make Experimental || true
1313
#TRES=0
1414
#ctest -T test --no-compress-output || true
1515
if [ -f Testing/TAG ] ; then
16-
xsltproc ../tests/ctest2junix.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > CTestResults.xml
16+
xsltproc ../tests/ctest2junix.xsl Testing/$(head -n 1 < Testing/TAG)/Test.xml > CTestResults.xml
1717
fi

scripts/qgis_srs.sh

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#
3838
# 1.0.3: Minor cosmetics in comments.
3939
#
40-
# 1.0.2: Replace 'latlon' and 'lonlat' in the `proj -le` output, so that QGIS
40+
# 1.0.2: Replace 'latlon' and 'lonlat' in the $(proj -le) output, so that QGIS
4141
# can parse the 'tbl_projection' table to provide the GCSs list in the
4242
# 'Projection' dialog (BTW, the dialog should be called 'Coordinate
4343
# system' actually, as a projection is only a component of a cs).
@@ -129,15 +129,15 @@ pop_tbl_projs ()
129129

130130
# Process each proj4 projection acronym...
131131

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

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

136-
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"`
136+
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")
137137

138138
#...count the number of parameters...
139139

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

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

@@ -189,24 +189,24 @@ pop_tbl_srss ()
189189
{
190190
# Populate SRSs table:
191191

192-
gdal_share=`gdal-config --datadir`
192+
gdal_share=$(gdal-config --datadir)
193193
no=0
194194

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

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

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

202202
if [ -n "$raw" ]; then
203203

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

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

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

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

225225
if [ -n "$raw" ]; then
226226

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

235235
echo "INSERT INTO tbl_srs VALUES(${no},'${name}','${proj}','${ellps}','${srs}',${epsg},${epsg},${isgeo});"

scripts/rename_class.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if [[ ${FILEPATH:(-1)} = "/" ]]; then
2323
PATH="${FILEPATH::-1}"
2424
fi
2525

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

2828
for f in $FILES
2929
do

scripts/sip_include.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ for module in "${modules[@]}"; do
5959
continue
6060
fi
6161
if ! egrep -xq '^(#define +)?SIP_NO_FILE' src/${module}/${header}; then
62-
sip=`${GP}sed -r 's/(.*)\.h$/\1.sip/' <<< ${header}`
63-
if_cond=`egrep -x '^(#define +)?SIP_IF_MODULE\((.*)\)$' src/${module}/${header} | \
64-
${GP}sed -r -e 's/(#define +)?SIP_IF_MODULE\((.*)\)/%If (\2)/'`
62+
sip=$(${GP}sed -r 's/(.*)\.h$/\1.sip/' <<< ${header})
63+
if_cond=$(egrep -x '^(#define +)?SIP_IF_MODULE\((.*)\)$' src/${module}/${header} | \
64+
${GP}sed -r -e 's/(#define +)?SIP_IF_MODULE\((.*)\)/%If (\2)/')
6565
if [[ ! -z $if_cond ]]; then
6666
echo "$if_cond" >> $file
6767
fi

0 commit comments

Comments
 (0)