How to execute bash script from bash script and react on echo [duplicate]How do I set a variable to the output of a command in Bash?How to compare strings in BashGet the source directory of a Bash script from within the script itselfHow to check if a string contains a substring in BashHow to check if a program exists from a Bash script?How to suppress all output from a command using Bash?How do I tell if a regular file does not exist in Bash?How do I split a string on a delimiter in Bash?How to concatenate string variables in BashReliable way for a Bash script to get the full path to itselfHow to change the output color of echo in LinuxEcho newline in Bash prints literal n

Who enforces MPAA rating adherence?

How does the Around command at zero work?

How can I end combat quickly when the outcome is inevitable?

Russian word for a male zebra

Is there a set of positive integers of density 1 which contains no infinite arithmetic progression?

How to safely destroy (a large quantity of) valid checks?

What is the color of artificial intelligence?

Projective subvarieties of a quasiprojective variety

Writing an augmented sixth chord on the flattened supertonic

Print lines between start & end pattern, but if end pattern does not exist, don't print

Bb13b9 confusion

I have a problematic assistant manager, but I can't fire him

Cascading Switches. Will it affect performance?

English word for "product of tinkering"

Is it possible to have a wealthy country without a middle class?

How to hide rifle during medieval town entrance inspection?

Determining fair price for profitable mobile app business

Is it possible for a vehicle to be manufactured without a catalytic converter?

Does the 2019 UA Artificer's Many-Handed Pouch infusion enable unlimited infinite-range cross-planar communication?

New pedal fell off maybe 50 miles after installation. Should I replace the entire crank, just the arm, or repair the thread?

Can a catering trolley removal result in a measurable reduction in emissions?

How to handle (one's own) self-harm scars (on the arm), in a work environment?

How do free-speech protections in the United States apply in public to corporate misrepresentations?

Someone whose aspirations exceed abilities or means



How to execute bash script from bash script and react on echo [duplicate]


How do I set a variable to the output of a command in Bash?How to compare strings in BashGet the source directory of a Bash script from within the script itselfHow to check if a string contains a substring in BashHow to check if a program exists from a Bash script?How to suppress all output from a command using Bash?How do I tell if a regular file does not exist in Bash?How do I split a string on a delimiter in Bash?How to concatenate string variables in BashReliable way for a Bash script to get the full path to itselfHow to change the output color of echo in LinuxEcho newline in Bash prints literal n






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0
















This question already has an answer here:



  • How do I set a variable to the output of a command in Bash?

    13 answers



  • How to compare strings in Bash

    10 answers



I have a bashscript that checkst the status of a program, if I do "/etc/init.d/checker status" it returns either "running" or "not running".
Now I want to write another bash script that triggers the "/etc/init.d/checker status" thing every x seconds and does something, depending on what the script returns/ echos.
Is this possible with bash, if so, how, or should I use PHP for this?










share|improve this question













marked as duplicate by Charles Duffy bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 24 at 19:24


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • Does it only return a string, or does it also change its exit status? A well-behaved program will be following LSB-defined exit status conventions for its init.d scripts, so you don't need to look at the output at all.

    – Charles Duffy
    Mar 24 at 19:19












  • It echoes it, does not change exit status.

    – Everlike
    Mar 24 at 19:21











  • See refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/… for those: 0 is for program is running or service is OK; 3 is for program is not running, 1 and 2 are for various kinds of unclean exits -- so if your program isn't honoring that standard, it's buggy, and I'd generally suggest focusing on fixing that bug rather than trying to write other software to work with the current behavior.

    – Charles Duffy
    Mar 24 at 19:21












  • Thank you very much!

    – Everlike
    Mar 24 at 19:22











  • ...that said, if you did want to work with the existing behavior, you could use the practices discussed in How to set a variable to the output of a command in bash (to capture the output), and How to compare strings in bash (to compare it to the values at hand).

    – Charles Duffy
    Mar 24 at 19:22


















0
















This question already has an answer here:



  • How do I set a variable to the output of a command in Bash?

    13 answers



  • How to compare strings in Bash

    10 answers



I have a bashscript that checkst the status of a program, if I do "/etc/init.d/checker status" it returns either "running" or "not running".
Now I want to write another bash script that triggers the "/etc/init.d/checker status" thing every x seconds and does something, depending on what the script returns/ echos.
Is this possible with bash, if so, how, or should I use PHP for this?










share|improve this question













marked as duplicate by Charles Duffy bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 24 at 19:24


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • Does it only return a string, or does it also change its exit status? A well-behaved program will be following LSB-defined exit status conventions for its init.d scripts, so you don't need to look at the output at all.

    – Charles Duffy
    Mar 24 at 19:19












  • It echoes it, does not change exit status.

    – Everlike
    Mar 24 at 19:21











  • See refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/… for those: 0 is for program is running or service is OK; 3 is for program is not running, 1 and 2 are for various kinds of unclean exits -- so if your program isn't honoring that standard, it's buggy, and I'd generally suggest focusing on fixing that bug rather than trying to write other software to work with the current behavior.

    – Charles Duffy
    Mar 24 at 19:21












  • Thank you very much!

    – Everlike
    Mar 24 at 19:22











  • ...that said, if you did want to work with the existing behavior, you could use the practices discussed in How to set a variable to the output of a command in bash (to capture the output), and How to compare strings in bash (to compare it to the values at hand).

    – Charles Duffy
    Mar 24 at 19:22














0












0








0









This question already has an answer here:



  • How do I set a variable to the output of a command in Bash?

    13 answers



  • How to compare strings in Bash

    10 answers



I have a bashscript that checkst the status of a program, if I do "/etc/init.d/checker status" it returns either "running" or "not running".
Now I want to write another bash script that triggers the "/etc/init.d/checker status" thing every x seconds and does something, depending on what the script returns/ echos.
Is this possible with bash, if so, how, or should I use PHP for this?










share|improve this question















This question already has an answer here:



  • How do I set a variable to the output of a command in Bash?

    13 answers



  • How to compare strings in Bash

    10 answers



I have a bashscript that checkst the status of a program, if I do "/etc/init.d/checker status" it returns either "running" or "not running".
Now I want to write another bash script that triggers the "/etc/init.d/checker status" thing every x seconds and does something, depending on what the script returns/ echos.
Is this possible with bash, if so, how, or should I use PHP for this?





This question already has an answer here:



  • How do I set a variable to the output of a command in Bash?

    13 answers



  • How to compare strings in Bash

    10 answers







bash ubuntu






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 24 at 19:15









EverlikeEverlike

134




134




marked as duplicate by Charles Duffy bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 24 at 19:24


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Charles Duffy bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 24 at 19:24


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Does it only return a string, or does it also change its exit status? A well-behaved program will be following LSB-defined exit status conventions for its init.d scripts, so you don't need to look at the output at all.

    – Charles Duffy
    Mar 24 at 19:19












  • It echoes it, does not change exit status.

    – Everlike
    Mar 24 at 19:21











  • See refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/… for those: 0 is for program is running or service is OK; 3 is for program is not running, 1 and 2 are for various kinds of unclean exits -- so if your program isn't honoring that standard, it's buggy, and I'd generally suggest focusing on fixing that bug rather than trying to write other software to work with the current behavior.

    – Charles Duffy
    Mar 24 at 19:21












  • Thank you very much!

    – Everlike
    Mar 24 at 19:22











  • ...that said, if you did want to work with the existing behavior, you could use the practices discussed in How to set a variable to the output of a command in bash (to capture the output), and How to compare strings in bash (to compare it to the values at hand).

    – Charles Duffy
    Mar 24 at 19:22


















  • Does it only return a string, or does it also change its exit status? A well-behaved program will be following LSB-defined exit status conventions for its init.d scripts, so you don't need to look at the output at all.

    – Charles Duffy
    Mar 24 at 19:19












  • It echoes it, does not change exit status.

    – Everlike
    Mar 24 at 19:21











  • See refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/… for those: 0 is for program is running or service is OK; 3 is for program is not running, 1 and 2 are for various kinds of unclean exits -- so if your program isn't honoring that standard, it's buggy, and I'd generally suggest focusing on fixing that bug rather than trying to write other software to work with the current behavior.

    – Charles Duffy
    Mar 24 at 19:21












  • Thank you very much!

    – Everlike
    Mar 24 at 19:22











  • ...that said, if you did want to work with the existing behavior, you could use the practices discussed in How to set a variable to the output of a command in bash (to capture the output), and How to compare strings in bash (to compare it to the values at hand).

    – Charles Duffy
    Mar 24 at 19:22

















Does it only return a string, or does it also change its exit status? A well-behaved program will be following LSB-defined exit status conventions for its init.d scripts, so you don't need to look at the output at all.

– Charles Duffy
Mar 24 at 19:19






Does it only return a string, or does it also change its exit status? A well-behaved program will be following LSB-defined exit status conventions for its init.d scripts, so you don't need to look at the output at all.

– Charles Duffy
Mar 24 at 19:19














It echoes it, does not change exit status.

– Everlike
Mar 24 at 19:21





It echoes it, does not change exit status.

– Everlike
Mar 24 at 19:21













See refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/… for those: 0 is for program is running or service is OK; 3 is for program is not running, 1 and 2 are for various kinds of unclean exits -- so if your program isn't honoring that standard, it's buggy, and I'd generally suggest focusing on fixing that bug rather than trying to write other software to work with the current behavior.

– Charles Duffy
Mar 24 at 19:21






See refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/… for those: 0 is for program is running or service is OK; 3 is for program is not running, 1 and 2 are for various kinds of unclean exits -- so if your program isn't honoring that standard, it's buggy, and I'd generally suggest focusing on fixing that bug rather than trying to write other software to work with the current behavior.

– Charles Duffy
Mar 24 at 19:21














Thank you very much!

– Everlike
Mar 24 at 19:22





Thank you very much!

– Everlike
Mar 24 at 19:22













...that said, if you did want to work with the existing behavior, you could use the practices discussed in How to set a variable to the output of a command in bash (to capture the output), and How to compare strings in bash (to compare it to the values at hand).

– Charles Duffy
Mar 24 at 19:22






...that said, if you did want to work with the existing behavior, you could use the practices discussed in How to set a variable to the output of a command in bash (to capture the output), and How to compare strings in bash (to compare it to the values at hand).

– Charles Duffy
Mar 24 at 19:22













0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript