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