Nettet30. mar. 2015 · while true is fine as a general-purpose "loop forever" construction. As other answers say, the body of the loop shouldn't be empty, or become empty by virtue of the command inside the loop not working. If you're using Linux, you may want to use a command like inotifywait, which makes the while loop much simpler: Nettet為了確保這一點,我正在嘗試編寫一個 bash 腳本,該腳本將在啟動時運行,執行我的主應用程序,並在出現故障(錯誤、異常等)時再次執行它。 這是我的腳本: #!/bin/bash while true do lxterminal --title="mytitle" --geometry=200x200 -e "./myapplication" done
linux - Between while and do in shell script - Unix & Linux Stack …
Nettet9.2.1. What is it? The while construct allows for repetitive execution of a list of commands, as long as the command controlling the while loop executes successfully (exit status of … Nettet5. des. 2024 · The syntax of the while command is: while test-commands; do consequent-commands ; done. Execute consequent-commands as long as test-commands has an … metal butterfly wall art gossip girl
监控php-fpm并自动重启服务的shell脚本-易采站长站
Nettetwhile : ; do something ; done & Earlier Bourne shells didn't have true and false as built-in commands. true was instead simply aliased to :, and false to something like let 0. & at the end of the line backgrounds the process : is the null command, as described by "help :": No effect; the command does nothing. Exit Status: Always succeeds. Share NettetYou could move the condition to the action-list and use break there (and use true or : as the condition-list) like with: while true do clear "is_purple_present_monitoring_script" grep purple break sleep 15 done But that would be quite a contrived way to use a while loop. Share Improve this answer Follow edited Aug 29, 2024 at 22:25 Nettet8. mai 2024 · bash provides the variable $!, which “expands to the process ID of the job most recently placed into the background”, so the following just kills the latest process … how the concepts of self influence behavior