bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

script with ssh and filenames with spaces


From: gscantlen
Subject: script with ssh and filenames with spaces
Date: Wed, 17 Jul 2013 20:42:17 +0000 (UTC)

plz help with this script, 

I wish to ssh this command to several hosts: 
ls -alst "dir_with_spaces" 

This script is close but I need DOUBLE-quotes around the remote command s 
#! /bin/bash 

PARAMS_FOR_LS=(-alst "dir with spaces") 

# get directory of local system 
ls "${PARAMS_FOR_LS[@]}" 

# get directory of remote systems 

#do search 'x' for a hostname; get host1 
ssh host1 ls "${PARAMS_FOR_LS[@]}" 

#do search 'y' for a hostname; get host2 
ssh host2 ls "${PARAMS_FOR_LS[@]}" 

#do search 'z' for a hostname; get host3 
ssh host3 ls "${PARAMS_FOR_LS[@]}" 


I have tried several variations of eval and echo. 
plz help 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]