Saturday, October 3, 2009

Forward slash and backslash in shell script and linux

Forward Slash in Linux and shell script
- The forward slash(/) is filename path separator in linux as well as in shell script. For example if we issue pwd then you will see the current directory location and location components might be separated by forward slash.

$ pwd
/home/Arju/t_dir

- Forward slash (/) is also arithmetic operator and works do division.
Example:

$ expr 18 / 4
4

Backslash in Linux and shell script
The backslash (\) is called the escape character. If we use \X then character X has the quoting effect. So \X is equivalent to 'X' But with echo and sed command backslash with certain character may have the special meaning.
For example,

\n means newline

\r means return

\t means tab

\v means vertical tab

\b means backspace

\a means alert (beep or flash)

Related Documents

No comments:

Post a Comment