Difference between revisions of "Bip"

From wikieduonline
Jump to navigation Jump to search
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
  
  while true; do [[tput bel]]; sleep 1; done
+
=== Bash ===
 +
  [[while]] true; do [[tput bel]]; sleep 1; done
  
 +
alias bip="while true; do tput bel; sleep 1; done"
  
== Check [[PID]] running ==
+
[[function]] bip () {
<pre>
+
    while true; do [[tput bel]]; sleep 1; done
#!/bin/bash
+
}
  
if [ $# -eq 0 ]
+
=== [[fish]] ===
then
+
while true; tput bel; sleep 1; end
    echo "Usage: $0 <process PID>"
+
    echo "Checks if a process is running by its PID."
 
    exit 1
 
fi
 
  
# Get the PID of the process to check from the command line argument
+
== Check [[PID]] running ==
process_pid=$1
 
  
# Check if the process is running
+
{{check PID running}}
if ps -p $process_pid > /dev/null
 
then
 
    echo "Process with PID $process_pid is running."
 
else
 
    echo "Process with PID $process_pid is not running. Running tput bel..."
 
    while true; do tput bel; sleep 1; done
 
fi
 
</pre>
 
  
 
== See also ==
 
== See also ==
 
* {{alias}}
 
* {{alias}}
 +
* {{sound}}
  
 
[[Category:Alias]]
 
[[Category:Alias]]

Latest revision as of 12:37, 14 February 2024

Bash[edit]

while true; do tput bel; sleep 1; done
alias bip="while true; do tput bel; sleep 1; done"
function bip () {
   while true; do tput bel; sleep 1; done
}

fish[edit]

while true; tput bel; sleep 1; end

Check PID running[edit]

#!/bin/bash

if [ $# -eq 0 ]
then
    echo "Usage: $0 <process PID>"
    echo "Checks if a process is running by its PID."
    exit 1
fi

# Get the PID of the process to check from the command line argument
process_pid=$1

# Check if the process is running
if ps -p $process_pid > /dev/null
then
    echo "Process with PID $process_pid is running."
else
    echo "Process with PID $process_pid is not running. Running tput bel..."
    while true; do tput bel; sleep 1; done
fi

See also[edit]

Advertising: