HOWTO search multiple modules

Technical issues/questions of an intermediate or advanced nature.
User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: HOWTO search multiple modules

Post#16 by Ed_P » 14 Jan 2019, 06:12

Like this.

Code: Select all

guest@porteus:~$ lsxzmgrep
bash: lsxzmgrep: command not found
guest@porteus:~$ lsxzmgrep /home/guest .sh
bash: lsxzmgrep: command not found
guest@porteus:~$ 
How are you doing on your vulnerabilities project? Vulnerability scanners
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Re: HOWTO search multiple modules

Post#17 by Rava » 14 Jan 2019, 06:20

Ed_P wrote:
14 Jan 2019, 06:12
Like this.

Code: Select all

guest@porteus:~$ lsxzmgrep
bash: lsxzmgrep: command not found
guest@porteus:~$ lsxzmgrep /home/guest .sh
bash: lsxzmgrep: command not found
guest@porteus:~$ 
I don't see a syntax error of lsxzmgrep . Enlighten me where such error message printed by lsxzmgrep is , since this is what I wrote in my post above.

And fun fact indeed, a command either has to exist in PATH and be executable by the user or exist as function or as alias to be able to be executed. I thought you knew that but seemingly you did not.
Ed_P wrote:
14 Jan 2019, 06:12
How are you doing on your vulnerabilities project? Vulnerability scanners
You are free to help.
Seems you have too much free time, as obvious in the way you ask about my vulnerabilities project every other day.

And you wrote a while back that interlink sounds compelling to you. (If I recall right, that was via PM) Have you since checked it out?
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: HOWTO search multiple modules

Post#18 by Ed_P » 15 Jan 2019, 16:44

We aren't connecting well, sorry.

You had said the HowTo was concluded and I was trying to say the conclusion didn't say the name of the script code. Yes I was being picky but you're a perfectionist. :D

FWIW What I have saved.

lsxzmgrep.sh

Code: Select all

#!/bin/bash
# Rava: https://forum.porteus.org/viewtopic.php?f=140&t=8143#p68189

for module in $(find $1 -type f -name "*.xzm"); do
    lsxzm ${module} | grep "$2" | sed -r "s#.+#${module}\n&#"
done
Rava wrote:
14 Jan 2019, 05:40
How should the user know that the correct syntax for lsxzmgrep is "lsxzmgrep [path] [grep-pattern]")
Before the "for" one could add:

Code: Select all

if [ "$1" == "" ] || [ "$2" == "" ]; then
   echo "lsxzmgrep [path] [grep-pattern]"
   read
   exit
fi   
Ed

Post Reply