Skip to content

echo command to append text to file

October 20, 2011

Echo command is useful in shell scripting to display a line, it also used to add text to the files without opening the particular file

Create a empty file using touch command

$ touch test

Add text to the file using echo command

$ echo hi > test

Now view the content using cat

$ cat test

hi

Append text to the file

$ echo hello >> test

Now view the content in the file

$ cat test

hi

hello

 

About these ads

From → Bash, Linux

Leave a Comment

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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: