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
linux shell-script shell scripting
New contributor
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.
add a comment |
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
linux shell-script shell scripting
New contributor
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 usingsh
?
– 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
add a comment |
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
linux shell-script shell scripting
New contributor
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
linux shell-script shell scripting
New contributor
New contributor
edited 8 hours ago
roaima
42k550115
42k550115
New contributor
asked Nov 22 at 18:36
Deepak Kumar Ray
1
1
New contributor
New contributor
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 usingsh
?
– 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
add a comment |
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 usingsh
?
– 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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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