echo

Print a string to standard output.

github

  • The file in jupyter notebook format on github is here .

google colaboratory

  • To run it in google colaboratory here /echo_nb.ipynb)

Environment

The author’s OS is macOS, and the options are different from those of Linux and Unix commands.

When you actually run the command, the leading ! and %%bash in the first line.

!sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G95
!bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.

Example usage

%%bash
echo "echo is basic option.
echo is basic option.

Typical options

  • n : do not give newline code
  • e : display with escape characters enabled.

n option.

%%bash
echo -n "linux"
echo " Linux"
linux Linux

e option

%%bash
echo -e "this is a pen.\nthis is a pen."
This is a pen.
This is a pen.