-
Notifications
You must be signed in to change notification settings - Fork 890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
airmon-ng.linux: in a for loop, replace ls
with a glob
#2551
Conversation
xtrace comparison: # original [root@localhost-live bug_airmon-ng-email]# set -x; for i in $(ls /sys/class/ieee80211/); do if [ ! -d "/sys/class/ieee80211/${i}/device/net" ]; then echo "$MISSING_INTERFACE" :: "$i"; fi; done; set - ++ ls --color=auto /sys/class/ieee80211/ + for i in $(ls /sys/class/ieee80211/) + '[' '!' -d /sys/class/ieee80211/phy0/device/net ']' + set - # change added [root@localhost-live bug_airmon-ng-email]# set -x; for i in /sys/class/ieee80211/*; do if [ -e "${i}" ] && [ ! -d "${i}/device/net" ]; then MISSING_INTERFACE="${i}"; echo "$MISSING_INTERFACE" :: "$i"; fi; done; set - + for i in /sys/class/ieee80211/* + '[' -e /sys/class/ieee80211/phy0 ']' + '[' '!' -d /sys/class/ieee80211/phy0/device/net ']' + set -
This is a good start, but unfortunately it entirely breaks the function
Also, please remove the two comments above your change since the comments are suggesting to do exactly what you are trying to do :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix setting MISSING_INTERFACE to the expected value. You changed the meaning of ${i} but didn't update it's use everywhere
Comments had read... #this should be fixed, but it's not going to be right now # shellcheck disable=2045 ...which referred to... https://www.shellcheck.net/wiki/SC2045
Fix setting MISSING_INTERFACE to the expected value, from commit e833818.
You're right; thank you. Two fixes have commits up for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested on zsh, dash, bash, and mksh
Looks great, thanks!
merging, one unrelated check failure |
thanks @wileyhy |
You're welcome! Thank _you_! :-)
…On Wed, Jul 19, 2023, 11:59 AM Zero_Chaos ***@***.***> wrote:
thanks @wileyhy <https://github.com/wileyhy>
—
Reply to this email directly, view it on GitHub
<#2551 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUF2F253NEEOA2FBBJJONQTXRAVBRANCNFSM6AAAAAA2D2HGQQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
The
[ -e
syntax covers the case of when the glob produces no matches andsh
uses the glob pattern itself as a value for "$i".xtrace comparison:
original
change added
Edit 1: formatting
Edit 2: note re
[ -e
syntax