Linux
CentOS
Ubuntu
shell
GNU

Linux—sleepで永遠に眠り続けるには whileループも秒数指定も要らなかったんだ

眠り続けよ

sleep infinity

動作環境

docker + ubuntu

$ docker run -it ubuntu sleep --help

Usage: sleep NUMBER[SUFFIX]...
  or:  sleep OPTION
Pause for NUMBER seconds.  SUFFIX may be 's' for seconds (the default),
'm' for minutes, 'h' for hours or 'd' for days.  Unlike most implementations
that require NUMBER be an integer, here NUMBER may be an arbitrary floating
point number.  Given two or more arguments, pause for the amount of time
specified by the sum of their values.

      --help     display this help and exit
      --version  output version information and exit

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Report sleep translation bugs to <http://translationproject.org/team/>
Full documentation at: <http://www.gnu.org/software/coreutils/sleep>
or available locally via: info '(coreutils) sleep invocation'

docker + centos

$ docker run -it centos:6 sleep --version

sleep (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jim Meyering and Paul Eggert.

etc

  • Docker version 18.06.0-ce, build 0ffa825