How to make shell script.

Hello!
Very long time to no see you.
How are these days treats you?
I hope you are enjoying your life.
Today, I’ll introduce “shell script” using “bash shell”
“bash shell” is the most popular shell.
You can use it on Linux/Mac and windows(if you install free bash emulating software such as MSYS.

Simple bash shell script it only prints messages

# charactor "sharp"(or it pronounced "hash") represents source-code comment
# it is confortable to take memo on your own source-code
echo "Long time no see you!!"
echo "I'm very happy to came back here."

You can excecute it by putting these commands.

NAGATO:~/shell$ chmod +x first.sh
NAGATO:~/shell$ bash first.sh

“chmod” command changes the specified file’s 3 privileges of users.
The privileges are “eXecution”,”Read” and “Write”.
There are changed by the command argument(which are follow first command word “chmod”) such as “+x”(it means plus the privilege for excecute the file.
Then, “chmod +x first.sh” means add user’s privilege for executing file “first.sh”.
“bash” means execute bash files and you can execute bash file(which have file extension “.sh”) by it.

The result is below.

Long time no see you!!
I'm very happy to came back here.

It’s so easy to write bash file isn’t it?
See you next article!!

Advertisements

About ながとタン
嫁で彼女で妹の有希と二人でいろいろがんばってます!

2 Responses to How to make shell script.

  1. kathy says:

    as if!

  2. This is very good. Can you please explain about loop in bash shell? I was never seen article such meaningful and self explainatory for scripting

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

%d bloggers like this: