There are three types of quotes
Quotes | Name | Meaning |
" | Double Quotes | "Double Quotes" - Anything enclose in double quotes removed meaning of that characters (except \ and $). |
' | Single quotes | 'Single quotes' - Enclosed in single quotes remains unchanged. |
` | Back quote | `Back quote` - To execute command |
Example:
-bash-3.00$ echo "Today is date"
Today is date
-bash-3.00$ echo "Today is `date`".
Today is Friday, 5 August 2011 05:49:13 IST.
-bash-3.00$ echo "sum is `expr 2 + 3` "
sum is 5
By default in Linux if particular command/shell script is executed, it return two type of values which is used to see whether command or shell script executed is successful or not.
(1) If return value is zero (0), command is successful.
(2) If return value is nonzero, command is not successful or some sort of error executing command/shell script.
This value is know as Exit Status
To determine this exit Status you can use $? special variable of shell.
-bash-3.00$ rm unknowfile
unknow1file: No such file or directory
-bash-3.00$ echo $?
2
-bash-3.00$ ls
d Din.sh opx_PAR_ERI_6as
dev first opx_PAR_ERI_720
-bash-3.00$ echo $?
0
-bash-3.00$ expr 1 + 3
4
-bash-3.00$ echo $?
0
No comments:
Post a Comment