Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

How to pass variable with spaces from shell to expect?

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 03-04-2012
urello urello is offline
Registered User
 
Join Date: Dec 2011
Last Activity: 1 March 2015, 1:04 PM EST
Posts: 64
Thanks: 4
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 Unix and Linux 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 Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 07:30 AM.