Commit 31073c9b authored by Vitaly Lipatov's avatar Vitaly Lipatov

add tests

parent 03fe0ad0
#!/bin/sh
run_command()
{
# use make_temp_file from etersoft-build-utils
RC_STDOUT=$(mktemp)
RC_STDERR=$(mktemp)
$1 >$RC_STDOUT 2>$RC_STDERR
}
func()
{
echo STDERR >&2
echo STDOUT
}
run_command func
cat $RC_STDOUT
cat $RC_STDERR
rm -f $RC_STDOUT $RC_STDERR
#!/bin/sh
run_command()
{
# use make_temp_file from etersoft-build-utils
RC_STDOUT=$(mktemp)
#RC_STDERR=$(mktemp)
$1 2>&1 | tee $RC_STDOUT
}
func()
{
echo STDERR >&2
echo STDOUT
}
run_command func
cat $RC_STDOUT
#cat $RC_STDERR
rm -f $RC_STDOUT $RC_STDERR
#!/bin/sh
store_output()
{
# use make_temp_file from etersoft-build-utils
RC_STDOUT=$(mktemp)
local CMDSTATUS=$RC_STDOUT.pipestatus
echo 1 >$CMDSTATUS
#RC_STDERR=$(mktemp)
( "$@" 2>&1 ; echo $? >$CMDSTATUS ) | tee $RC_STDOUT
return $(cat $CMDSTATUS)
# bashism
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
#return $PIPESTATUS
}
clean_store_output()
{
rm -f $RC_STDOUT $RC_STDOUT.pipestatus
}
store_output epmq mc
echo $?
cat $RC_STDOUT
ls -l $RC_STDOUT
store_output epmq mc1
echo $?
cat $RC_STDOUT
ls -l $RC_STDOUT
# param true false
subst_option()
{
eval "[ -n \"\$$1\" ]" && echo "$2" || echo "$3"
}
test1=1
test0=
echo $(subst_option test1 TRUE)
echo $(subst_option test1 TRUE FALSE)
echo $(subst_option test1 "" FALSE)
echo $(subst_option test0 "" FALSE)
echo $(subst_option test0 TRUE)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment