-
Notifications
You must be signed in to change notification settings - Fork 0
/
sinusoide.sh
42 lines (42 loc) · 1.02 KB
/
sinusoide.sh
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
#!/bin/bash
# ******************************************************************************************
# *
# * File: sinusoide.sh
# *
# * Function: Print a sinusoid running with time
# *
# * Author: Franco Tommasi
# *
# * Course: Sistemi Operativi I - Facoltà di Ingegneria - Università del Salento
# *
# * Copyright: CreativeCommons 2008 - Attribution-Noncommercial-Share Alike 2.5 Generic
# *
# * Notes:
# *
# * Change History:
# * 20080221092249 First draft
# * 20120522101800 Minor revisions
# *
# ******************************************************************************************
#
if [ $# -ne 1 ]; then
echo 'Usage export COLUMNS; ./sinusoide.sh frequenza';
exit;
fi
if [ -z $COLUMNS ]; then
echo 'Usage: export COLUMNS; ./sinusoide.sh frequenza';
exit;
fi
ampiezza=$(( COLUMNS/2 ))
frequenza=$1
t=0;
while true;
do
b=$(echo "c=$ampiezza*s($frequenza*$t*3.14/180);scale=0; $ampiezza + c/1" | bc -l);
for (( a = 1; a < b; a++ ));
do
echo -n " ";
done;
echo '*';
((t++))
done