File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 134
134
```
135
135
- to interpret special characters: ` echo -e "This is \n a new line" `
136
136
- to disable new line trailing special characters: ` echo -n "This line will not be followed by a new line" `
137
-
137
+
138
+ ### operation on scalar variables:
139
+
140
+ ```
141
+ sentence="today is sunday"
142
+ echo ${#sentence} //will print 4
143
+ echo ${#sentence:2} //will print day is sunday
144
+ echo ${#sentence:2:3} //will print day
145
+ echo ${#sentence:-zaki} //will print zaki if sentence wasn't defined or empty.
146
+ echo ${#sentence:=zaki} //will print zaki if sentence wasn't defined or empty+ the sentence variable will be initializaed with "zaki" as value.
147
+ echo ${#sentence:+zaki} //will print zaki, sentence will be initializaed wit the zaki value if it was defined and wasn't empty.
148
+
149
+ ```
You can’t perform that action at this time.
0 commit comments