THIS THREAD IS NOT SOLVED!
No you certainly cannot replace sE with echo and still get that error message.
Sorry sea, but you've failed to provide enough info for anyone to tell what is wrong.
Marko had a pretty good guess at what it might be.
You've given no evidence that output is empty, defined, undefined or anything else.
Have you learned to do shell debugging with all your extensive and ornate scripts ?
set -x
is a good start.
Quote:
|
It seemed that the variable name 'output' was reserved, because adding the same strings to another varablename did solve the problem.
|
NO! Wrong. You should not spread misinformation. You foul your own thinking when you misinform yourself; you foul your reputation and harm others when you spread misinformation. You are just making things up to evade finding the actual cause of the problem.
First learn to use the correct terminology b/c bad language leads to bad thinking. You are NOT "adding" strings. You are forming a complex command line and you are failing to understand exactly how it is being evaluated. Bash command line evaluation is quite complex, no shame in being confused.
Maybe this will help your thinking,
Code:
countem ()
{
echo "arg count = $#";
for ((i=1; $#>0; i++))
do
echo "$i: [$1]";
shift;
done
}
Code:
[stevea@crucibulum Desktop]$ countem a b c d
arg count = 4
1: [a]
2: [b]
3: [c]
4: [d]
[stevea@crucibulum Desktop]$ countem "a b c d"
arg count = 1
1: [a b c d]
[stevea@crucibulum Desktop]$ countem "a b" "c d"
arg count = 2
1: [a b]
2: [c d]
[stevea@crucibulum Desktop]$
What this means is that each command line arguments by first expanding any variables, and passing each arg separately - where args are separated by an IFS char not withing quotes. It is NOT ADDED and NOT CONCATENATED.
Now when those individual args (which may contain an IFS char) are re-evaluated by the SE or sT functions or commands - you must very careful to understand that the IFS are RE-evaluted.
Code:
[stevea@crucibulum Desktop]$ call_countem() { countem $* ; }
[stevea@crucibulum Desktop]$ countem "a b " "c d"
arg count = 2
1: [a b ]
2: [c d]
[stevea@crucibulum Desktop]$ call_countem "a b " "c d"
arg count = 4
1: [a]
2: [b]
3: [c]
4: [d]
But bash provides ways around this ...
Code:
[stevea@crucibulum Desktop]$ call_countem2() { countem "$@" ; }
[stevea@crucibulum Desktop]$ call_countem2 "a b" "c d"
arg count = 2
1: [a b]
2: [c d]
What do you think this does ?
Code:
[stevea@crucibulum Desktop]$ QT='"'
[stevea@crucibulum Desktop]$ call_countem $QT "help me" $QT
Do you understand why this gives a different result ?
Code:
[stevea@crucibulum Desktop]$ eval call_countem $QT "help me" $QT