Fun with bash

Posted on Updated on

I run a lot of make files at work .. but I never pay attention to how they process stuff just what they do.
Seeing as I have a lot of free time I decided to check out the basic stuff on how this language works.

Below is a very simple script that takes 2 integers as parameters, and checks whether both have equal value or not. If they do, just print a message saying “etc is equal to etc2”, if not then “etc is not equal to etc2”

#!/bin/sh
test_val_one="$1"
test_val_two="$2"
if [ $test_val_two -eq $test_val_one ]
then
	echo $test_val_one 'は' $test_val_two 'と同じ値'
else
	echo $test_val_one 'は' $test_val_two 'と違う値'
fi	
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s