Using Defined Variables in a Shell Script

Hi everyone and thanks for any help ahead of time. This may be a very simple question for an experienced scripter, but I am just learning.


set my_name to text returned of (display dialog "Enter Your CMC Username" with title "Add PoppaMain Printer" with icon caution default answer "" buttons {"Continue"} default button 1)
set my_pass to text returned of (display dialog "Enter Your CMC Password" with title "Add PoppaMain Printer" with icon caution default answer "" buttons {"Continue"} default button 1 with hidden answer)

do shell script "/usr/sbin/lpadmin -p PoppaMain -E -v smb://my_name:my_pass@mckenna/ls2-mach/poppa-main -P /Library/Printers/PPDS/Contents/Resources/en.lproj/CanonIR.ppd -D \"Poppa-Main\""

All I need is to have the Applescript use the variables my_name and my_pass in the shell script, specifically where they are now in plain text. Please tell me how I can insert these variables into the the plain text command and then have it executed as such.

Carter,

First of all welcome.

Well what you are looking for is not shell only but you want to concatenate strings. Well that easy:

set a to " World!"
set theString to "Hello " & a
return theString

so you command could be this:


do shell script "/usr/sbin/lpadmin -p PoppaMain -E -v smb://" & my_name & ":" & my_pass & "@mckenna/ls2-mach/poppa-main -P /Library/Printers/PPDS/Contents/Resources/en.lproj/CanonIR.ppd -D \"Poppa-Main\""

Thanks DJ, that worked great. I knew it would be a quick fix, and I am happy to have found this great site.