i need a equivalent for the statement i run in bash, so it would also run in other shells. Specially i need it for ksh to run on AIX.
Here the statements:
I'm not sure this ever did quite what you thought. It could certainly change the perceived order of stdout/stderr. The two different, separate tees are liable to stomp on each other's lines. And this may interfere with redirections run outside the script, too. It's only a strange concidence of how bash works that gives this the appearance of working under some circumstances, but it also did weird things like catching prompts...
Potentially changing the order stdout/stderr come in order is inevitable when doing this, and doing this reliably is always cumbersome since it's supposed to be done from the outside.
This is the shortest "reliable" one I've yet seen managed:
There's shorter/simpler versions using tail -f, to just print the output file instead of catching it midway, but it's possible for them to skip output and hang, not to mention all your output ends up going to stdout. The worst this one will do is reorder stderr/stdout and possibly print a line on your prompt after it quits -- unfortunately inevitable unless you're prepared to make a lot of guarantees about what your code will and won't be doing with traps and stdin/stdout/stderr. Right now this shouldn't interfere with those.
Last edited by Corona688; 10-16-2014 at 03:56 PM..
I have the following code in bash, however "set red frmt" is not displayed.
echo "iarg_rd = $iarg_rd"
iarg_rd="2"
if ; then
echo "Hello World"
fi
if ; then
frmt="${gap}${!frmt_titl_yl}"
elif ; then
frmt="${gap}${!frmt_titl_bk}"
elif ; then
echo... (2 Replies)
Hi Gurus,
I have the below BASH code which does not works for upper case alphabets except Z (upper case Z).
What may be the reason. Also escape sequences like \n, \t, \b, \033(1m \033(0m (For bold letter) are not working.
case $var in
)
echo "Lower case alphabet"
;;
... (7 Replies)
Hey guys,
Currently trying to write a wee script that runs only when logged in as one of two users. The rest of the script is working fine, but no matter what user I try to run it as, it always fails! This is the puzzling part:if ]; then
echo "Run script as admin "
exit 1
else... (6 Replies)
Hi I need a script with an if statement that goes.
I need it to search through all files within a directory with the extension .test if it finds the string '71502FSC1206' then do
sed 's/71502FSC1206/\n&/g' > send.test
If it finds the string '715MCH' or '715JAC' then I need it to move the... (1 Reply)
I want to combine 2 conditional statements by using -o in bash, but it won't work.
if ; then
echo "The number needs to be between 0 and $nr"
fi
Each time i execute the file it says:
./selectCitaat: line 10: syntax error near unexpected token `$1' (3 Replies)
In Perl I can write a condition that evaluates a match expression like this:
if ($foo =~ /^bar/) {
do blah blah blah
}
How do I write this in shell? What I need to know is what operator do I use? The '=~' doesn't seem to fit. I've tried different operators, I browsed the man page for... (3 Replies)
I really like tcsh's:
set completion='enhanced'
because it treats underscores and dash signs the same. I don't have to reach for the shift key when trying to complete files that have underscores. As far as I know, there is nothing like this in bash.
Does such a thing exist in bash? If... (2 Replies)
Hi folks,
I need to stop printing a new line after echoing a string in KSH. i know bash provides
echo -n "string"
what is the ksh equivalent for this ? (3 Replies)