mirror of
https://github.com/autistic-symposium/shell-whiz-toolkit.git
synced 2025-05-15 05:02:23 -04:00
add things resources from the last 5 years over machines
This commit is contained in:
parent
ac9c955e0b
commit
3efc19e1f2
77 changed files with 2327 additions and 84 deletions
30
awk/math2.awk
Normal file
30
awk/math2.awk
Normal file
|
@ -0,0 +1,30 @@
|
|||
# awk -f math2
|
||||
|
||||
BEGIN {
|
||||
myprompt = "(To Stop press CTRL+D) > "
|
||||
printf "Welcome to MyAddtion calculation awk program v0.1\n"
|
||||
printf "%s" ,myprompt
|
||||
}
|
||||
|
||||
{
|
||||
no1 = $1
|
||||
op = $2
|
||||
no2 = $3
|
||||
ans = 0
|
||||
|
||||
if ( op == "+" )
|
||||
{
|
||||
ans = $1 + $3
|
||||
printf "%d %c %d = %d\n" ,no1,op,no2,ans
|
||||
printf "%s" ,myprompt
|
||||
}
|
||||
else
|
||||
{
|
||||
printf "Opps!Error I only know how to add.\nSyntax: number1 + number2\n"
|
||||
printf "%s" ,myprompt
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
printf "\nGoodbye, %s\n !" , ENVIRON["USER"]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue