alhassani54
Programmer
Hi
I have a variable which contains one character. The character can be any value.
I need to pass this value to a function and act on this value to split a file.
function f_split_mint
{
st=$1
i=1
echo $rec | sed 's/'$st'/\
'$st'/g' | while read line
do
if [[ -n "$line" ]]
then
echo "$line" > $ICMAPPDIR/icmapptmp$i
((i=i+1))
fi
done
}
#
If The character is "\".
If I call the function as f_split_mint '\\' the function work ok.
But If I set the value to a variable (SDIM) and call the function it does not work
Set the variable to:-
SDIM=$(head -c -n8 $file |tail -c2) # where SDIM is \
Call the function as
f_split_mint '$SDIM' # it does not work
Any help
Thank you
I have a variable which contains one character. The character can be any value.
I need to pass this value to a function and act on this value to split a file.
function f_split_mint
{
st=$1
i=1
echo $rec | sed 's/'$st'/\
'$st'/g' | while read line
do
if [[ -n "$line" ]]
then
echo "$line" > $ICMAPPDIR/icmapptmp$i
((i=i+1))
fi
done
}
#
If The character is "\".
If I call the function as f_split_mint '\\' the function work ok.
But If I set the value to a variable (SDIM) and call the function it does not work
Set the variable to:-
SDIM=$(head -c -n8 $file |tail -c2) # where SDIM is \
Call the function as
f_split_mint '$SDIM' # it does not work
Any help
Thank you