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 8386365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:54:59+00:00 2026-06-09T17:54:59+00:00

I have the following script: tail -f nohup.out echo 5 When I press Ctrl

  • 0

I have the following script:

tail -f nohup.out
echo 5

When I press Ctrl+C on tail -f, the script stops running: the 5 is not printed. How can I run the command echo 5 after I stop the tail 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-09T17:55:00+00:00Added an answer on June 9, 2026 at 5:55 pm

    Ctrl+C sends the SIGINT signal to all the processes in the foreground process group. While tail is running, the process group consists of the tail process and the shell running the script.

    Use the trap builtin to override the default behavior of the signal.

    trap " " INT
    tail -f nohup.out
    trap - INT
    echo 5
    

    The code of the trap does nothing, so that the shell progresses to the next command (echo 5) if it receives a SIGINT. Note that there is a space between the quotes in the first line; any shell code that does nothing will do, except an empty string which would mean to ignore the signal altogether (this cannot be used because it would cause tail to ignore the signal as well). The second call to trap restores the default behavior, so that after the third line a Ctrl+C will interrupt the script again.

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

Sidebar

Related Questions

i have the following script and i can't find out how to use the
I have the following script running successfully. However if I try to use a
I have the following script that works well in Firefox and Chrome (not sure
I have the following script to clean my Visual Studio 2010 solution directory: @echo
I have the following script in Oacle I do not understand why i get
I have the following script that loads a page into a div and not
I have the following script, $createZip = { Param ([String]$source, [String]$zipfile) Process { echo
I have the following bash script: tail -F -n0 /private/var/log/system.log | while read line
I have following script: jQuery('#content-page-<?php echo $post->ID ?>') .data('content','<div class=page-content><?php echo $post->post_content; ?>'); In
I have following script that executes all the .reg files in the current directory.

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.