passing Applescript strings to Bash

I have an Applescript pgm that let’s the user select a file. I place the filename in a string variable named “Ifile”. I have a Bash shell program the will strip out all the bad characters in a name. How can I pass the Applescript variable sting contents in “Ifile” to bash a variable “wifile” in my shell script.

set wfile to choose file
set Ifile to POSIX path of wfile
set inforec to info for wfile
set cfile to “load script doit”
set Ifile to do shell script (“echo” > “& wifile &”)
display dialog Ifile
tell application “Terminal”
activate
do script “doit”
end tell

Model: Dual 2.5 GHz G5 - 4.5 GB DDR SDRAM
AppleScript: 1.10 Script Editor 2.1 (80)
Browser: Safari 412
Operating System: Mac OS X (10.4)

If the shell app takes the POSIX path as an argument:

set fileAlias to choose file
set posixPath to POSIX path of fileAlias
do shell script ("your-shell-app " as Unicode text & quoted form of posixPath)

If it takes the path on stdin (the ‘do shell script’ command doesn’t support stdin itself, unfortunately):

do shell script ("echo " as Unicode text & quoted form of posixPath & " | your-shell-app")

do shell script (“echo " as Unicode text & quoted form of posixPath & " | your-shell-app”)
seems to work . But how do I push the echo display into a string variable in my Bash shell app