aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Aparício <aparicio99@gmail.com>2012-06-11 02:45:15 +0100
committerAndré Aparício <aparicio99@gmail.com>2012-08-03 01:03:35 +0100
commit3b61db33dab08044404af5ae9123b9bad85f7b05 (patch)
treef5e22e929c1db8917d9d349a54c8560c5756e618 /scripts
parentWalker: Support local declaration inside eval (diff)
downloadlibbash-3b61db33dab08044404af5ae9123b9bad85f7b05.tar.gz
libbash-3b61db33dab08044404af5ae9123b9bad85f7b05.tar.bz2
libbash-3b61db33dab08044404af5ae9123b9bad85f7b05.zip
Parser&Walker: Support redirection
The order of the arguments for commands in the AST was changed, it was 'command_atom redirection', and now it's 'redirection command_atom'. This is due to the need of having the redirection set before evaluating the expression.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/command_execution.bash11
-rw-r--r--scripts/here_document.ast4
2 files changed, 13 insertions, 2 deletions
diff --git a/scripts/command_execution.bash b/scripts/command_execution.bash
index 901a9bb..3b275ca 100644
--- a/scripts/command_execution.bash
+++ b/scripts/command_execution.bash
@@ -96,3 +96,14 @@ eval abc+=\( \"\$@\" \)
declare MOZILLA_FIVE_HOME="/usr/share/${PN}"
declare foo=23 empty bar=42
echo $MOZILLA_FIVE_HOME $foo $lol $bar
+
+FILE=scripts/input_output_test
+echo foo > $FILE
+read line < scripts/input_output_test
+echo $line
+if [ 1 = 1 ]; then
+ read line
+ echo $line
+fi < $FILE
+read string <<< "a b c d"
+echo $string
diff --git a/scripts/here_document.ast b/scripts/here_document.ast
index 4dadb03..612fa0b 100644
--- a/scripts/here_document.ast
+++ b/scripts/here_document.ast
@@ -1,7 +1,7 @@
(LIST (COMMAND (STRING cat) (<< (STRING blah
blah
-) (REDIR > (STRING / dev / null)))) (COMMAND (STRING echo) (STRING hi)) (COMMAND (STRING cat) (REDIR > (STRING (DOUBLE_QUOTED_STRING / dev / null))) (<<- (STRING
+) (REDIR > (STRING / dev / null)))) (COMMAND (STRING echo) (STRING hi)) (COMMAND (REDIR > (STRING (DOUBLE_QUOTED_STRING / dev / null))) (STRING cat) (<<- (STRING
java - Dtijmp . jar = " $(java-config -p tijmp) " - agentlib : tijmp " $ { @ } "
-))) (COMMAND (STRING cat) (REDIR > (STRING (DOUBLE_QUOTED_STRING / dev / null))) (<<- (STRING
+))) (COMMAND (REDIR > (STRING (DOUBLE_QUOTED_STRING / dev / null))) (STRING cat) (<<- (STRING
java - Dtijmp . jar = " $(java-config -p tijmp) " - agentlib : tijmp " $ { @ } "
))))