Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8743163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:37:42+00:00 2026-06-13T11:37:42+00:00

I tried below command to store output to variable : k=$(kill -HUP 1234) #command

  • 0

I tried below command to store output to variable :

k=$(kill -HUP 1234)  #command getting executed but not storing to variable
echo "$k"

For checking if the output contains the word, i can do like this :

  if [[ outputvar =~ .*No such process*. ]]

As per the examples, above should work , but i donno why its not working . Can you tell me correct way so that if I cannot restart the process, I can atleast start a new process with direct gunicorn_django command

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:37:42+00:00Added an answer on June 13, 2026 at 11:37 am

    Usually such error messages are output on the stderr stream, while the $() construct returns only the stdout stream. You need to redirect stderr to stdout:

    k=$(kill -HUP 1234 2>&1)
    

    Your regular expression has an error: the *. at the end must be .*; you will also need to quote your strings in your test:

    if [[ "$k" =~ .*No\ such\ process.* ]]
    

    Note that "$k" is quoted, while the spaces in the regular expression are escaped; you cannot quote the regular expression (as ".*No such process.*"), as using a quoted string in a =~ test forces string match instead of a regular expression match.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried command like below. But can't see server time. psexec \\SERVER_NAME -i -u
I've tried the below script but I am getting an error: dim cn, rs
i tried the awk liner below(on windows command-prompt):not working properly gawk -v var=hot {
i want to update all records in my database(mongodb),I tried to use command below
I tried below code but as I run it gives a black screen image
i tried below javascript and it does open the url in open window but
Possible Duplicate: How can I store Perl's system function output to a variable? I
I'm trying to store the output of the find command to an array. I
I tried the below, and it seems that 'test' results in wrong value. 2500*2500*2500
I tried the below code to check whether my mobile is connected to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.