commit: 759fb65536efbd7efd171d0fb8e461d192b5c0d9 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> AuthorDate: Thu Aug 28 12:53:42 2014 +0000 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> CommitDate: Thu Aug 28 12:53:42 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/eselect.git;a=commit;h=759fb655
Remove redundant $@ in "for" loops throughout. * libs/core.bash.in (inherit): * libs/tests.bash.in (has): * modules/config.eselect (generic_handle_one_file, accept_handler) (merge_handler, display_handler): * modules/news.eselect (find_items, do_list, do_read, do_unread): * modules/rc.eselect (run_runscript, do_show): Remove redundant $@ in "for" loops throughout. --- ChangeLog | 10 ++++++++++ libs/core.bash.in | 2 +- libs/tests.bash.in | 2 +- modules/config.eselect | 8 ++++---- modules/news.eselect | 8 ++++---- modules/rc.eselect | 4 ++-- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f01c16..92d7730 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2014-08-28 Ulrich Müller <u...@gentoo.org> + + * libs/core.bash.in (inherit): + * libs/tests.bash.in (has): + * modules/config.eselect (generic_handle_one_file, accept_handler) + (merge_handler, display_handler): + * modules/news.eselect (find_items, do_list, do_read, do_unread): + * modules/rc.eselect (run_runscript, do_show): Remove redundant $@ + in "for" loops throughout. + 2014-06-05 Ulrich Müller <u...@gentoo.org> * misc/eselect.bashcomp (_eselect): Improve handling of options diff --git a/libs/core.bash.in b/libs/core.bash.in index 1384188..cc263b8 100644 --- a/libs/core.bash.in +++ b/libs/core.bash.in @@ -111,7 +111,7 @@ do_action() { # Sources a given eselect library file inherit() { local x - for x in "$@"; do + for x; do [[ -e ${ESELECT_CORE_PATH}/${x}.bash ]] \ || die "Couldn't find ${x}.bash" source "${ESELECT_CORE_PATH}/${x}.bash" \ diff --git a/libs/tests.bash.in b/libs/tests.bash.in index eeafc94..8fb8559 100644 --- a/libs/tests.bash.in +++ b/libs/tests.bash.in @@ -20,7 +20,7 @@ has() { local test=${1} item shift - for item in "$@" ; do + for item; do [[ ${item} == ${test} ]] && return 0 done return 1 diff --git a/modules/config.eselect b/modules/config.eselect index dfa3826..7383b2f 100644 --- a/modules/config.eselect +++ b/modules/config.eselect @@ -62,7 +62,7 @@ generic_handle_one_file() { local file_raw file # for each parameter... - for file_raw in "$@" ; do + for file_raw; do [[ -z ${file_raw} ]] && continue # do we have a number or a name? @@ -162,7 +162,7 @@ do_accept() { accept_handler() { local file - for file in "$@" ; do + for file; do local sfile="${file}" dfile="${file/._cfg????_}" echo "Replacing ${dfile} with ${sfile}..." mv --interactive "${sfile}" "${dfile}" @@ -201,7 +201,7 @@ do_merge() { merge_handler() { local file - for file in "$@" ; do + for file; do local sfile="${file}" dfile="${file/._cfg????_}" echo "Merging ${dfile} with ${sfile}..." merge_prog ${dfile} ${sfile} @@ -242,7 +242,7 @@ do_display() { display_handler() { local file - for file in "$@" ; do + for file; do local sfile="${file}" dfile="${file/._cfg????_}" echo "Proposed changes to ${dfile}:" diff_prog -u ${dfile} ${sfile} diff --git a/modules/news.eselect b/modules/news.eselect index 782f81c..3cc1f84 100644 --- a/modules/news.eselect +++ b/modules/news.eselect @@ -15,7 +15,7 @@ NEWS_DIR="/var/lib/gentoo/news" # sort order: by item name (i.e. effectively by date) find_items() { local stat repos=$(get_repositories) repo file item - for stat in "$@"; do + for stat; do for repo in ${repos}; do file="${EROOT}${NEWS_DIR}/news-${repo}.${stat}" [[ -f ${file} ]] || continue @@ -174,7 +174,7 @@ do_list() { set -- $(find_items unread read) write_list_start "News items:" - for item in "$@"; do + for item; do stat=${item%%/*}; item=${item#*/} repo=${item%%/*}; item=${item#*/} find_repo_dir "${repo}" @@ -270,7 +270,7 @@ do_read() { && echo "No news is good news." fi - for i in "$@"; do + for i; do if ! is_number "${i}" || [[ ${i} -lt 1 || ${i} -gt ${#items[@]} ]] then write_warning_msg "Bad item number: ${i}" @@ -378,7 +378,7 @@ do_unread() { set -- ${seq} fi - for i in "$@"; do + for i; do if ! is_number "${i}" || [[ ${i} -lt 1 || ${i} -gt ${#items[@]} ]] then write_warning_msg "Bad item number: ${i}" diff --git a/modules/rc.eselect b/modules/rc.eselect index f02abf7..6e1d3e5 100644 --- a/modules/rc.eselect +++ b/modules/rc.eselect @@ -90,7 +90,7 @@ show_script_status() { run_runscript() { local command=${1} shift - for script in "$@"; do + for script; do is_script "${EROOT}/etc/init.d/${script}" \ && /sbin/runscript "${EROOT}/etc/init.d/${script}" "${command}" done @@ -250,7 +250,7 @@ do_show() { fi fi - for runlevel in "$@"; do + for runlevel; do [[ -n ${runlevel} && -d ${EROOT}/etc/runlevels/${runlevel} ]] \ || die -q "\"${runlevel}\" is no valid runlevel"