Script to pretend that something important is running


Originally posted as GitHub Gist on 04 May 2016 , updated at 16 Nov 2020 (details)


Source: https://gist.github.com/paulera/a96d8a302f654ef6d6bf688732fc7daa

Description: Pretend your terminal is doing techy things

Fake process script

Simulates a build/configuration/installation-like process, using a random message with a nice fake progress, with percentage, random total and variable pace. The command does it as many times and as fast as you set in 2 first variables (maxsteps and pace). Goes really well with a cup of coffee! ;)

  • maxsteps = number of steps to run until “finish”.
  • pace = step increment speed. Lower numbers are faster. 500 works well.
  • Arrays a, b and c = word lists. change them as you like, words separated by space.

Minified version (for quick procrastination)

1
clear; maxsteps=88; pace=500; a=( Tracking Updating Building Compiling Analyzing Saving Optimizing Scanning Checking Loading ); b=( system downloaded core hidden indexed compressed obfuscated scheduled default binary ); c=( files resources dependencies folders socket packages entries library list drivers ); j=0; while (( j < maxsteps )); do ((j++)); echo -n "$j) ${a[$[$RANDOM % ${#a[@]} ]]} ${b[$[$RANDOM % ${#b[@]} ]]} ${c[$[$RANDOM % ${#c[@]} ]]} "; total=$(( 20 + ($RANDOM % 150) )); for i in $(seq 0 $total); do ii="   "$((100*i/total)); echo -n -e ". > [${ii:(-2)}%]\b\b\b\b\b\b\b\b"; s=000$(($RANDOM % pace)); sleep 0.${s:(-3)}; done; echo " ok!     "; done; echo -n -e "\nFinished\n\n";

Expanded version (for scripting)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh

# Simulates a build/configuration/installation-like process, using a
# random message with a nice fake progress, with percentage, random total
# and variable pace. The command does it as many times and as fast as you
# set in 2 first variables (maxsteps and pace). Goes really well with a
# cup of coffee! ;)
#
# https://gist.github.com/paulera/a96d8a302f654ef6d6bf688732fc7daa
# by Paulo Amaral

clear;

# set behaviour
maxsteps=88;
pace=500;

# word lists
a=( Tracking Updating Building Compiling Analyzing Saving Optimizing Scanning Checking Loading );
b=( system downloaded core hidden indexed compressed obfuscated scheduled default binary );
c=( files resources dependencies folders socket packages entries library list drivers );

j=0;
while (( j < maxsteps )); do

	((j++));

	echo -n "$j) ${a[$[$RANDOM % ${#a[@]} ]]} ${b[$[$RANDOM % ${#b[@]} ]]} ${c[$[$RANDOM % ${#c[@]} ]]} ";

	# total = number of increments for this step
	total=$(( 20 + ($RANDOM % 150) ));
	
	# progess bar from 0% to 100%
	for i in $(seq 0 $total); do
	
		ii="   "$((100*i/total));
		echo -n -e ". > [${ii:(-2)}%]\b\b\b\b\b\b\b\b";
		# sleep a random interval for that organic touch
		s=000$(($RANDOM % pace));
		sleep 0.${s:(-3)};
		
	done;
	echo " ok!     ";
	
done;
echo -n -e "\nFinished\n\n";

Output looks like…

1) Scanning indexed socket ............................................. ok!
2) Optimizing scheduled folders ....................................................................................................................................................................... ok!
3) Building system files ........................................................................... ok!
4) Compiling binary resources ....................................................... ok!
5) Checking scheduled files .................................................................................................................................................................. ok!
6) Scanning scheduled dependencies .................................................................... ok!
7) Saving indexed dependencies .................................................................................... ok!
8) Loading obfuscated list ................................... ok!
9) Analyzing indexed socket ............ ok!
10) Updating default library .............................................................................................................................................. ok!
11) Building scheduled drivers ............................................................... ok!
12) Optimizing binary dependencies ......................... ok!
13) Optimizing system entries .............................................................................................................................................................. ok!
14) Optimizing binary library .................. > [20%]

Finished