Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a0c79c4

Browse files
Shell variables magic
1 parent d95222f commit a0c79c4

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

‎README.md‎

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -981,23 +981,22 @@ do
981981
done
982982
```
983983
3. The PATH is usually fixed in the shell file so that it looks only within that path and nowhere else. This prevents running unwanted programs with the same name as the current one that reside somewhere else in the system. So the path that you specify in your shell file overrides the actual system-wide PATH.
984+
- The use of **braces with variables** has special meanings. the following construct:
985+
```sh
986+
t=${1-60}
987+
```
988+
This is similar to default variable values in languages like python. It means set t to the given argument. Another rather self-explanatory example is:
989+
```sh
990+
echo $varx
991+
echo ${var}x
992+
```
993+
these two variables ared different. The first example prints whatever is contained by the variable varx. The second one prints the contents of the variable var and append 'x' to its end.
994+
```sh
995+
echo {something?I am sick}
996+
```
984997
985998
986999
9871000
9881001
9891002
990-
991-
992-
993-
994-
995-
996-
997-
998-
999-
1000-
1001-
1002-
1003-

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /