Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call a function with Parameter

Status
Not open for further replies.

alhassani54

Programmer
Aug 1, 2002
27
0
0
GB
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top