Page 2 of 2

Re: HOWTO search multiple modules

Posted: 14 Jan 2019, 06:12
by Ed_P
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

Re: HOWTO search multiple modules

Posted: 14 Jan 2019, 06:20
by Rava
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?

Re: HOWTO search multiple modules

Posted: 15 Jan 2019, 16:44
by Ed_P
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