Home > front end >  What is the purpose of the ":" (colon) in 'trap : TERM INT; ...'
What is the purpose of the ":" (colon) in 'trap : TERM INT; ...'

Time:01-11

I found some sample code to keep a docker build container running until it gets stopped. It uses

/bin/ash -c "trap : TERM INT; sleep infinity & wait"

as parameter.

Why is the ':' needed? Another stackoverflow mentions the colon is just used for side effects, but here I'd assume TERM INT is needed as a trap argument.

CodePudding user response:

The : is the command that will be executed on receipt of TERM or INT. It is a noop, so basically you can think of it as if the signals are ignored.

  •  Tags:  
  • Related