2

I'm trying to run an expect script that runs a telnet session to automate the sending of an email, I'm trying to pass the contents of a file as a single argument to my script but when the backticks are interpreted the white space in that file are causing multiple arguments to be passed.

Here's my command...

runTelnet `cat test_results.txt`

Is there a way to quote the output of a backtick expression?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Lewis Briffa
  • 121
  • 1

2 Answers2

3

Try:

runTelnet "$(cat test_results.txt)"
1

Use:

runTelnet "`cat test_results.txt`"

Enclosing the backticks in quotes will cause the results of the command to be passed to runTelnet as a single argument.

clk
  • 2,116
  • 1
  • 17
  • 25