[CentOS-devel] [PATCH] Added script for extracting what I think is the dist tag
Elias Persson
delreich at takeit.se
Wed Jun 11 09:08:44 UTC 2014
Maybe I'm too sleep deprived to make sense of what I'm reading,
but...
On 2014-06-10 16:12, Karanbir Singh wrote:
> On 06/10/2014 03:08 PM, Pat Riehecky wrote:
>> From: Pat Riehecky <riehecky at fnal.gov>
<snip>
>> +#####################################################################
>> +# setup args in the right order for making getopt evaluation
>> +# nice and easy. You'll need to read the manpages for more info
>> +args=$(getopt -o hr -- "$@")
>> +if [[ $? -ne 0 ]]; then
>> + usage
>> +fi
>> +eval set -- "$args"
>> +
>> +RHELTAG=0
>> +for arg in $@; do
Shouldn't this be quoted (or just `for arg;`)?
Otherwise, why not just use `$args` and skip the `eval set ...`?
>> + case $1 in
>> + -- )
>> + # end of getopt args, shift off the -- and get out of the loop
<snip>
>> + exit 1
>> +fi
>> +
>> +msg=$(git log --pretty=format:"%s")
>> +pkg=$(echo ${msg} | cut -d' ' -f2)
More missing quoting?
>> +
>> +if [[ ${RHELTAG} -eq 0 ]]; then
>> + thispkg=(echo ${pkg} | head -1)
>> +elif [[ ${RHELTAG} -eq 1 ]]; then
>> + thispkg=(echo ${pkg} grep -v centos | head -1)
In addition to the already mentioned missing $:s, there should
presumably be a pipe before that `grep`, and unless that `head`
is redundant, `${pkg}` should be quoted.
(Unless there's some portability issue I'm missing, isn't
`grep -v -m 1 -e centos` equivalent?)
>> +else
>> + echo 'Something went terribly wrong'
>> + exit 1
>> +fi
>> +
>> +tag=$(echo ${thispkg} | awk -F"-" '{print $NF}' | tr '.' '\012'| grep -e el[[:digit:]])
>> +
>> +echo ${tag}
>>
>
>
More information about the CentOS-devel
mailing list