• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 486
  • Last Modified:

Passing $variable to rsh

I need a way to pass a variable from a shell script to rsh.  Currently rsh ignores the $variable.  This is running on AIX version 4.3.  Here is the command I am trying to execute:

rsh server01 'cp -p $dir/$filenm $dir/$filenm.old'

The userid has permission to run rsh and write to the directory on the remote server specified by the $dir variable.
0
gwj
Asked:
gwj
  • 2
1 Solution
 
tfewsterCommented:
Use double quotes, i.e.
rsh server01 "cp -p $dir/$filenm $dir/$filenm.old"
0
 
tfewsterCommented:
Use double quotes, i.e.
rsh server01 "cp -p $dir/$filenm $dir/$filenm.old"

The variables within the double quotes are substituted before they are executed by rsh

(Strange, I thought I had posted this once...)

0
 
gwjAuthor Commented:
The search feature was disabled when I entered the question.  I had tried double quotes but only around the $variables, not the whole command.  Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now