Match a word and then run a command [on hold]











up vote
-3
down vote

favorite












I have one command (tail -100 rt.txt | grep Ticket) to read from last 100 line of rt.txt file and matches specific word Ticket, If This word matches in last 100 line even single time.It should run command like "ps -aux| grep root".



#!/bin/sh
word = tail -100 rt.txt | grep Ticket
tap = ps -aux| grep root
if grep -qF "Ticket" $word;then
echo "$tap"
else
echo "Sorry this string not in file"
fi









share|improve this question









New contributor




Deepak Kumar Ray is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by Romeo Ninov, RalfFriedl, Thomas, G-Man, andcoz 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information." – Romeo Ninov, RalfFriedl, Thomas, G-Man

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Use shellcheck.net to fix the glaring errors first.
    – roaima
    Nov 22 at 18:45










  • Why have you tagged bash for a script that claims to be written using sh?
    – roaima
    Nov 22 at 18:48










  • Welcome to Unix Stackexchange! You can take the tour first and then learn how to ask a good question. That makes it easier for us to help you.
    – andcoz
    2 days ago















up vote
-3
down vote

favorite












I have one command (tail -100 rt.txt | grep Ticket) to read from last 100 line of rt.txt file and matches specific word Ticket, If This word matches in last 100 line even single time.It should run command like "ps -aux| grep root".



#!/bin/sh
word = tail -100 rt.txt | grep Ticket
tap = ps -aux| grep root
if grep -qF "Ticket" $word;then
echo "$tap"
else
echo "Sorry this string not in file"
fi









share|improve this question









New contributor




Deepak Kumar Ray is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by Romeo Ninov, RalfFriedl, Thomas, G-Man, andcoz 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information." – Romeo Ninov, RalfFriedl, Thomas, G-Man

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Use shellcheck.net to fix the glaring errors first.
    – roaima
    Nov 22 at 18:45










  • Why have you tagged bash for a script that claims to be written using sh?
    – roaima
    Nov 22 at 18:48










  • Welcome to Unix Stackexchange! You can take the tour first and then learn how to ask a good question. That makes it easier for us to help you.
    – andcoz
    2 days ago













up vote
-3
down vote

favorite









up vote
-3
down vote

favorite











I have one command (tail -100 rt.txt | grep Ticket) to read from last 100 line of rt.txt file and matches specific word Ticket, If This word matches in last 100 line even single time.It should run command like "ps -aux| grep root".



#!/bin/sh
word = tail -100 rt.txt | grep Ticket
tap = ps -aux| grep root
if grep -qF "Ticket" $word;then
echo "$tap"
else
echo "Sorry this string not in file"
fi









share|improve this question









New contributor




Deepak Kumar Ray is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have one command (tail -100 rt.txt | grep Ticket) to read from last 100 line of rt.txt file and matches specific word Ticket, If This word matches in last 100 line even single time.It should run command like "ps -aux| grep root".



#!/bin/sh
word = tail -100 rt.txt | grep Ticket
tap = ps -aux| grep root
if grep -qF "Ticket" $word;then
echo "$tap"
else
echo "Sorry this string not in file"
fi






linux shell-script shell scripting






share|improve this question









New contributor




Deepak Kumar Ray is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Deepak Kumar Ray is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 8 hours ago









roaima

42k550115




42k550115






New contributor




Deepak Kumar Ray is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 22 at 18:36









Deepak Kumar Ray

1




1




New contributor




Deepak Kumar Ray is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Deepak Kumar Ray is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Deepak Kumar Ray is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as off-topic by Romeo Ninov, RalfFriedl, Thomas, G-Man, andcoz 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information." – Romeo Ninov, RalfFriedl, Thomas, G-Man

If this question can be reworded to fit the rules in the help center, please edit the question.




put on hold as off-topic by Romeo Ninov, RalfFriedl, Thomas, G-Man, andcoz 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information." – Romeo Ninov, RalfFriedl, Thomas, G-Man

If this question can be reworded to fit the rules in the help center, please edit the question.












  • Use shellcheck.net to fix the glaring errors first.
    – roaima
    Nov 22 at 18:45










  • Why have you tagged bash for a script that claims to be written using sh?
    – roaima
    Nov 22 at 18:48










  • Welcome to Unix Stackexchange! You can take the tour first and then learn how to ask a good question. That makes it easier for us to help you.
    – andcoz
    2 days ago


















  • Use shellcheck.net to fix the glaring errors first.
    – roaima
    Nov 22 at 18:45










  • Why have you tagged bash for a script that claims to be written using sh?
    – roaima
    Nov 22 at 18:48










  • Welcome to Unix Stackexchange! You can take the tour first and then learn how to ask a good question. That makes it easier for us to help you.
    – andcoz
    2 days ago
















Use shellcheck.net to fix the glaring errors first.
– roaima
Nov 22 at 18:45




Use shellcheck.net to fix the glaring errors first.
– roaima
Nov 22 at 18:45












Why have you tagged bash for a script that claims to be written using sh?
– roaima
Nov 22 at 18:48




Why have you tagged bash for a script that claims to be written using sh?
– roaima
Nov 22 at 18:48












Welcome to Unix Stackexchange! You can take the tour first and then learn how to ask a good question. That makes it easier for us to help you.
– andcoz
2 days ago




Welcome to Unix Stackexchange! You can take the tour first and then learn how to ask a good question. That makes it easier for us to help you.
– andcoz
2 days ago















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Accessing regular linux commands in Huawei's Dopra Linux

Can't connect RFCOMM socket: Host is down

Kernel panic - not syncing: Fatal Exception in Interrupt