How to pass variable with spaces from shell to expect? | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to pass variable with spaces from shell to expect?

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-04-2012
urello urello is offline
Registered User
 
Join Date: Dec 2011
Last Activity: 15 July 2014, 7:00 AM EDT
Posts: 59
Thanks: 3
Thanked 1 Time in 1 Post
How to pass variable with spaces from shell to expect?

I need call expect script from shell script and pass values some of which could contain space. How to make expect to treat such values as one variable?
Sponsored Links
    #2  
Old 03-04-2012
chihung chihung is offline
Registered User
 
Join Date: Jun 2008
Last Activity: 31 July 2012, 10:08 PM EDT
Location: Singapore
Posts: 191
Thanks: 3
Thanked 46 Times in 45 Posts
I believe if you double quote your variable when you can expect, it should work. Example:

Code:
my-expect-code "$shellvar1" "$shellvar2"

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to pass a variable from shell to awk metaltree UNIX for Dummies Questions & Answers 2 01-12-2011 02:52 PM
Not able to pass string with spaces in shell patilrakesh1984 Shell Programming and Scripting 15 03-30-2010 03:50 AM
Pass a string with spaces to a shell script vivelafete Shell Programming and Scripting 3 11-24-2009 05:32 AM
Is it possible to pass variable from awk to shell script user_prady Shell Programming and Scripting 3 12-18-2007 09:06 AM
Strip leading and trailing spaces only in a shell variable with embedded spaces jerardfjay Shell Programming and Scripting 6 03-07-2005 01:24 PM



All times are GMT -4. The time now is 03:03 AM.