2

I need to execute a command with timeout so it's killed after X time.

I have done tests and it only works when typed in the terminal directly, when in a bash script it seems to not handle the user input like it's not "receiving it"

3
  • What is the script? what input does the script accept? Commented Oct 21, 2017 at 11:42
  • @val0x00ff I solved it, should I delete this question?
    – Freedo
    Commented Oct 21, 2017 at 11:51
  • 2
    You can post your own answer and accept is as solved. It could help others who have the same problem. Commented Oct 21, 2017 at 11:53

1 Answer 1

2

I found a solution looking at the man page. You need to use timeout --foreground 120s to have your command accept user input when executed in a bash script.

1
  • Which man page helped you ?
    – X Tian
    Commented Oct 21, 2017 at 13:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .