/
differences_bash_sh.txt
115 lines (85 loc) · 3.37 KB
/
differences_bash_sh.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
DIFFERENCES_BASH_SH
Voici quelques fonctionnalites non supportes par sh :
GENERAL
- sh is posix-conformant, et tous les autres shells sont rétro-compatibles avec lui
- hash
- cd -L, cd -P, pwd -L, pwd -P
- IFS splits only the results of expansion, not all words
- command-line editing
BASH 4
- coprocesses
- ${VAR^} ${VAR^^} ${VAR,} ${VAR,,}
ENVIRONNEMENT
- help
- more options with set
- la forme set -o name
- shopt
- UID, EUID, and GROUPS, HOSTTYPE, OSTYPE, MACHTYPE, HOSTNAME, BASH, BASH_VERSION and BASH_VERSINFO automatically set
HISTORY
- command history
- history and fc builtins
- history list maintains timestamp information and uses the value of the HISTTIMEFORMAT variable to display it
- history expansion
ARRAY MANIPULATION
- several array operations
- +=
- ${ARR#... ${ARR... ${ARR%... ${ARR%%... ${ARR/#... ${ARR/%... ${ARR/... ${ARR//..., ${ARR:...
- ${#ARR...}
STRUCTURES ET BOUCLES
- for (( EXPR1 ; EXPR2 ; EXPR3 ))
- select structure
- [[ ]]
- $( COMMANDES )
- <( ) et >( )
- The test builtin is slightly different
VARIABLES
- ${!VAR}
- ${NOMBRE} pour les arguments positionnels
- ${!LETTRES*}
- Variables in the shell's initial environment are automatically exported to child processes without export statements
- export, readonly and declare can take a -f, -p and -n option and ‘name=value’
- type
- Variable assignments preceding commands affect only that command, even builtins and functions. In sh, all variable assignments preceding commands are global unless the command is executed from the file system.
REDIRECTIONS
- filename expansion even if input and output redirection
- <> and &>
- <<<STRING
- N<&M and N>&M
- treats a number of filenames specially when used in redirection
- can open network connections with the redirection operators
- noclobber option and >|
- ! keyword to negate a pipeline
FONCTIONS
- possible to have a variable and a function with the same name
- allows a function to override a builtin with the same name
- export -f
- return
- local
TIME
- time, timing and TIMEFORMAT variable
- $TMOUT
GLOBBING AND SHORTCUTS
- $'...'
- $"..."
- alias and unalias
- extglob shell option
- filename expansion operators, including character classes, equivalence classes, and collating symbols
READ AND PRINTF
- printf
- $REPLY
- read has -r, -p, -e, -s, -t, -n and -d options
DEBUGGING
- caller
- trap has DEBUG and ERR
AUTRES
- bind
- complete, compgen and compopt
- builtins
- builtin
- additionnal options to exec
- umask has a -p option
- pushd, popd, dirs and $DIRSTACK
- interprets special backslash-escaped characters in the interactive prompt
- disown