2017-08-05 04:33:47 +08:00
|
|
|
|
|
|
|
####################
|
|
|
|
# Comments in odd places don't cause problems
|
2005-09-20 21:31:55 +08:00
|
|
|
1a
|
|
|
|
1b
|
|
|
|
2a
|
|
|
|
2b
|
2017-08-05 04:33:47 +08:00
|
|
|
|
|
|
|
####################
|
|
|
|
# Bracket expansion
|
2012-11-21 05:52:53 +08:00
|
|
|
x-1
|
|
|
|
x-1 x-2
|
|
|
|
foo-1 foo-23 foo-24
|
2018-01-02 22:20:19 +08:00
|
|
|
foo-{}
|
|
|
|
foo-{} foo-{}
|
|
|
|
foo-
|
|
|
|
|
|
|
|
foo- foo- foo- foo-
|
2018-01-02 22:24:48 +08:00
|
|
|
foo- foo-, foo-
|
2017-08-05 04:33:47 +08:00
|
|
|
|
|
|
|
####################
|
|
|
|
# Escaped newlines
|
2012-11-22 17:09:07 +08:00
|
|
|
foo bar
|
|
|
|
foobar
|
|
|
|
foobar
|
|
|
|
foo\
|
|
|
|
bar
|
2012-11-24 04:03:36 +08:00
|
|
|
a
|
|
|
|
b
|
|
|
|
c
|
2017-08-05 04:33:47 +08:00
|
|
|
|
|
|
|
####################
|
|
|
|
# Simple function tests
|
2005-09-20 21:31:55 +08:00
|
|
|
Test 2 pass
|
2017-07-04 06:36:38 +08:00
|
|
|
Test 3a pass
|
|
|
|
Test 3b pass
|
2010-11-23 23:05:21 +08:00
|
|
|
Test 4 pass
|
2017-08-05 04:33:47 +08:00
|
|
|
|
|
|
|
####################
|
2019-04-14 01:04:44 +08:00
|
|
|
# Testing builtin status
|
2010-11-24 00:35:56 +08:00
|
|
|
Test 5 pass
|
2017-08-05 04:33:47 +08:00
|
|
|
|
|
|
|
####################
|
|
|
|
# Verify that we can turn stderr into stdout and then pipe it
|
2013-08-19 07:55:01 +08:00
|
|
|
errput
|
|
|
|
output
|
2019-03-25 12:12:41 +08:00
|
|
|
errput
|
2019-04-04 07:47:05 +08:00
|
|
|
output
|
2017-08-05 04:33:47 +08:00
|
|
|
|
|
|
|
####################
|
|
|
|
# Test that trailing ^ doesn't trigger redirection, see #1873
|
2016-06-12 17:16:46 +08:00
|
|
|
caret_no_redirect 12345^
|
2017-08-05 04:33:47 +08:00
|
|
|
|
|
|
|
####################
|
|
|
|
# Verify that we can pipe something other than stdout
|
2014-01-13 18:49:41 +08:00
|
|
|
is_stdout
|
2017-06-19 13:25:00 +08:00
|
|
|
|
2017-08-05 04:33:47 +08:00
|
|
|
####################
|
2017-06-19 13:25:00 +08:00
|
|
|
# echo tests
|
2012-10-17 17:56:03 +08:00
|
|
|
abc\ndef
|
|
|
|
abc
|
|
|
|
def
|
|
|
|
abc\zdef
|
|
|
|
abc!def
|
|
|
|
abc!def
|
|
|
|
abcQdef
|
|
|
|
abcQ2def
|
|
|
|
abc
|
2014-05-16 15:19:07 +08:00
|
|
|
-
|
2017-06-19 13:25:00 +08:00
|
|
|
-h
|
2017-02-01 10:44:02 +08:00
|
|
|
0000000 376
|
|
|
|
0000001
|
2012-10-17 17:56:03 +08:00
|
|
|
Catch your breath
|
|
|
|
abc!def
|
|
|
|
abc!1def
|
2017-08-05 04:33:47 +08:00
|
|
|
|
|
|
|
####################
|
|
|
|
# Verify that pipes don't conflict with fd redirections
|
2015-01-05 06:18:06 +08:00
|
|
|
pipe 3
|
|
|
|
pipe 4
|
|
|
|
pipe 5
|
|
|
|
pipe 6
|
|
|
|
pipe 7
|
|
|
|
pipe 8
|
|
|
|
pipe 9
|
|
|
|
pipe 10
|
|
|
|
pipe 11
|
|
|
|
pipe 12
|
2017-08-05 04:33:47 +08:00
|
|
|
|
|
|
|
####################
|
|
|
|
# Make sure while loops don't run forever with no-exec (#1543)
|
2014-07-12 02:28:10 +08:00
|
|
|
Checking for infinite loops in no-execute
|
2017-08-05 04:33:47 +08:00
|
|
|
|
2017-08-21 03:02:45 +08:00
|
|
|
####################
|
|
|
|
# For loops with read-only vars is an error (#4342)
|
|
|
|
|
2019-01-19 02:24:49 +08:00
|
|
|
####################
|
|
|
|
# That goes for non-electric ones as well (#5548)
|
|
|
|
|
2017-09-09 12:14:26 +08:00
|
|
|
####################
|
|
|
|
# For loop control vars available outside the for block
|
|
|
|
$loop_var: set in local scope, unexported, with 1 elements
|
|
|
|
$loop_var[1]: length=1 value=|c|
|
|
|
|
$loop_var: not set in global scope
|
|
|
|
$loop_var: not set in universal scope
|
|
|
|
|
|
|
|
$loop_var: set in local scope, unexported, with 1 elements
|
|
|
|
$loop_var[1]: length=1 value=|b|
|
|
|
|
$loop_var: set in global scope, unexported, with 1 elements
|
|
|
|
$loop_var[1]: length=10 value=|global_val|
|
|
|
|
$loop_var: not set in universal scope
|
|
|
|
|
|
|
|
$loop_var: not set in local scope
|
|
|
|
$loop_var: set in global scope, unexported, with 1 elements
|
|
|
|
$loop_var[1]: length=10 value=|global_val|
|
|
|
|
$loop_var: not set in universal scope
|
|
|
|
|
|
|
|
$loop_var: set in local scope, unexported, with 1 elements
|
|
|
|
$loop_var[1]: length=2 value=|cc|
|
|
|
|
$loop_var: set in global scope, unexported, with 1 elements
|
|
|
|
$loop_var[1]: length=10 value=|global_val|
|
|
|
|
$loop_var: not set in universal scope
|
|
|
|
|
|
|
|
$loop_var: not set in local scope
|
|
|
|
$loop_var: set in global scope, unexported, with 1 elements
|
|
|
|
$loop_var[1]: length=10 value=|global_val|
|
|
|
|
$loop_var: not set in universal scope
|
|
|
|
|
|
|
|
|
2017-08-05 04:33:47 +08:00
|
|
|
####################
|
|
|
|
# Comments allowed in between lines (#1987)
|
2015-04-06 14:47:04 +08:00
|
|
|
before comment after comment
|
2017-08-05 04:33:47 +08:00
|
|
|
|
|
|
|
####################
|
|
|
|
# Backslashes are part of comments and do not join lines (#1255)
|
|
|
|
|
|
|
|
####################
|
|
|
|
# Verify $argv set correctly in sourced scripts (#139)
|
2016-04-07 04:04:44 +08:00
|
|
|
source argv {}
|
|
|
|
source argv {}
|
|
|
|
source argv {abc}
|
|
|
|
source argv {abc def}
|
2014-02-12 17:39:06 +08:00
|
|
|
1
|