[LINUX] A shell program that becomes aho in multiples of 3


I created it as a small story of Bash programming. Was it popular in the past? A multiple of 3 or a number that includes 3 is aho.



echo -n "Please input end number => "
read num


while (( $count <= $num ))
  if (( $count % 3 == 0 ))
      echo "aho"
    else if  [ "`echo $count | grep 3`" ]
        echo "aho"
        echo $count
  (( count+=1 ))
  sleep 1

Execution result

$ ./aho.sh

Please input end number => 15

in conclusion

By creating this program

--Branch syntax --Repeating syntax --test command ([] or ``) --Bash's manners

I understand.

Recommended Posts

A shell program that becomes aho in multiples of 3
A program that removes duplicate statements in Python
A shell program that displays the Fibonacci sequence
[Python] A program that counts the number of valleys
[Python] A program that compares the positions of kangaroos.
[Python] A program that finds the shortest number of steps in a game that crosses clouds
A Python program in "A book that gently teaches difficult programming"
I tried "a program that removes duplicate statements in Python"
A set of script files that do wordcloud in Python3
Summary of points to keep in mind when writing a program that runs on Python 2.5
[Note] A shell script that checks the CPU usage of a specific process in a while loop.
I made a program that solves the spot the difference in seconds
A function that measures the processing time of a method in python
Implement a deterministic finite automaton in Python to determine multiples of 3
A program that determines whether a number entered in Python is a prime number
When writing a program in Python
The story of writing a program
[Python] A program that rotates the contents of the list to the left
A story about creating a program that will increase the number of Instagram followers from 0 to 700 in a week
[Python] A program that calculates the number of chocolate segments that meet the conditions
[Python] A program that calculates the number of socks to be paired
I made a program to check the size of a file in Python
Code reading of faker, a library that generates test data in Python
A memorandum of filter commands that you might forget in an instant
[Python] A program that creates stairs with #
I made a payroll program in Python!
Sum of variables in a mathematical model
Write a Caesar cipher program in Python
A program that plays rock-paper-scissors using Python
[Python] A program that rounds the score
Project Euler # 1 "Multiples of 3 and 5" in Python
I made a program in Python that reads CSV data of FX and creates a large amount of chart images
A collection of Numpy, Pandas Tips that are often used in the field
A personal memo of Pandas related operations that can be used in practice
Publishing and using a program that automatically collects facial images of specified people
Create a BOT that displays the number of infected people in the new corona
[Python] A program that calculates the number of updates of the highest and lowest records
A program that sends a fixed amount of mail at a specified time by Python
A set of integers that satisfies ax + by = 1.
Draw a graph of a quadratic function in Python
A memo that I wrote a quicksort in Python
Nogizaka46 A program that automatically saves blog images
Make a copy of the list in Python
Find the number of days in a month
Rewriting elements in a loop of lists (Python)
A program that searches for the same image
A proposal for versioning of features in Kedro
Make a joyplot-like plot of R in python
Output in the form of a python array
Get a glimpse of machine learning in Python
A well-prepared record of data analysis in Python
Try creating a FizzBuzz problem with a shell program
Derivation of certainty of effect in A / B testing
I made a Caesar cryptographic program in Python.
If you define a method in a Ruby class and define a method in it, it becomes a method of the original class.
A program that notifies slack of the operating status of fully automatic botanical photography equipment
A memo that implements the job of loading a GCS file into BigQuery in Python
Simple code that gives a score of 0.81339 in Kaggle's Titanic: Machine Learning from Disaster
A story that an error occurred when PyInstaller was used in a program that uses googleapiclient
[Shell art] Only when it is a multiple of 3 and a number with 3 becomes stupid
A note that runs an external program in Python and parses the resulting line