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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:59:23+00:00 2026-06-17T19:59:23+00:00

I think generate temp file may slower and if user press ctrl + c

  • 0

I think generate temp file may slower and if user press ctrl+c the temp file will become garbage.

Here is my original code

for f in bin/* ; do
  ldd $f 2>/dev/null | awk '{print $1}'
done | sort -u | grep -v -e '^not$' -e 'ld-linux' > list.1
while read soname ; do
  process_so_name $soname
done < list.1

Is it possible to remove the temp file list.1?

  • 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-17T19:59:24+00:00Added an answer on June 17, 2026 at 7:59 pm

    Just do it without a temp file. Pipe the result of the last grep into the while.

    You can hook into SIGINT to detect Ctrl+C, but why worry if you don’t need to? You still won’t be able to hook into SIGKILL.

    for f in bin/* ; do
      ldd $f 2>/dev/null | awk '{print $1}'
    done | sort -u | grep -v -e '^not$' -e 'ld-linux' | while read soname ; do
      process_so_name $soname
    done
    

    You can make this look more recognizable by placing the loops in functions (you can do this in a script file or right in the shell):

    step_1() {
      for f in bin/* ; do
        ldd $f 2>/dev/null | awk '{print $1}'
      done
    }
    
    step_2() {
      while read soname ; do
        process_so_name $soname
      done
    }
    
    step_1 | grep -v -e '^not$' -e 'ld-linux' | step_2
    

    To hook into SIGINT, do something like this:

    trap "echo SIGINT; rm -f tempfile; exit -1" INT
    

    To hook into SIGTERM (see comments underneath), do this:

    trap "echo SIGTERM; rm -f tempfile; exit -1" EXIT
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm think something like Facebook apps here. User generated pieces of code that people
I think following code should generate an error: #include <iostream> #include <string> static void
here's the code(Where I think the NullPointerException is generated): public String getData(String s1,String s2,String
The code below generate file name based on: destination directory, radio station name and
I need to help to generate column name from excel automatically. I think that:
I need to implement a operation in which the user requests a file which
I think I am missing something simple here. I am getting the error: Violation
I use \b to generate backspace in PHP: But I think it doesn't work:
Example of the temp.txt file: File: t091110_065921.SFTC Src: J1903+0925 Nsub: 1 Nch: 1 Npol:
My Python code generates a list everytime it loops: list = np.genfromtxt('temp.txt', usecols=3, dtype=[('floatname','float')],

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.