IGPenguin / mobile-toolkit

πŸ“± Terminal tool for Android & iOS device management

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resolve ignored Shellcheck issues

IGPenguin opened this issue Β· comments

🐞 Whats wrong

The following warnings are currently ignored in new pull requests:

  • SC2001 - replace sed with ${variable//search/replace}
  • SC1090 - non-constant source
  • SC2207 - no arrays like this ($())
Using xargs -I
Given the -I option, xargs will perform an action for each line of text that we feed into it. We can give the line a variable name to use in commands that xargs can execute.
$ adb devices | tail -n +2 | cut -sf -1 | xargs -I X echo X aw yiss
ZY2222NP55 aw yiss
192.168.56.101:5555 aw yiss
We can see here that we have told xargs to take each line of text (each identifier), and refer to it as X. Then execute the echo command with the identifier and the string β€œ aw yiss”. And xargs happily obliges.

🌈 Desired state

All Shellcheck issues are resolved and none are ignored.

πŸ“ Challenges

I dont have deep shell skills πŸ˜…

πŸ“‚ Sources

google.com