Quote and variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Quote and variable
# 1  
Old 01-24-2009
Quote and variable

The command line bellow works fine by itself.
Code:
/opt/csw/bin/rsync -azq --delete -e "ssh -i /.ssh/ss" /home/ me@myaccount.storage.com:/home/

Now I would like to introduce some variable into it and make a .sh file such as bellow and it does not work anymore. I guess the part -e "ssh -i /.ssh/ss" has syntax error but I don't know what to do. Any hint appreciated.
Code:
#!/bin/sh
DIR=/home/
/opt/csw/bin/rsync -azq --delete -e "ssh -i /.ssh/ss" "$DIR" me@myaccount.storage.com:"$DIR"

# 2  
Old 01-24-2009
Have you tried use ${DIR} instead of "$DIR" ?
# 3  
Old 01-24-2009
Quote:
Originally Posted by SebaM6
Have you tried use ${DIR} instead of "$DIR" ?

Why would that make any difference?
# 4  
Old 01-25-2009
Are you sure this is correct? "ssh -i /.ssh/ss"

That implies you are using a directory named .ssh in the root ( / ), not your home directory.

If you are using the standard SSH configuration subdirectory in your home directory, then drop the extra slash (or add a tilde ( ~ ):
"ssh -i .ssh/ss"
# 5  
Old 01-26-2009
Quote:
Originally Posted by cfajohnson
Why would that make any difference?
Well I was not sure but I assumed that problem is caused by variables. So if only sh would not understand quotation mark this notation could help.

But as I mentioned it was just shot.

ngungo

Try to launch your script with "sh -x" and "ssh -vv". Maybe it will show anything valuable.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help/Advise please for converting space delimited string variable to comma delimited with quote

Hi, I am wanting to create a script that will construct a SQL statement based on a a space delimited string that it read from a config file. Example of the SQL will be For example, it will read a string like "AAA BBB CCC" and assign to a variable named IN_STRING. I then concatenate... (2 Replies)
Discussion started by: newbie_01
2 Replies

2. Shell Programming and Scripting

Replacing all but the first and last double quote in a line with a single quote with awk

From: 1,2,3,4,5,This is a test 6,7,8,9,0,"This, is a test" 1,9,2,8,3,"This is a ""test""" 4,7,3,1,8,"""" To: 1,2,3,4,5,This is a test 6,7,8,9,0,"This; is a test" 1,9,2,8,3,"This is a ''test''" 4,7,3,1,8,"''"Is there an easy syntax I'm overlooking? There will always be an odd number... (5 Replies)
Discussion started by: Michael Stora
5 Replies

3. Shell Programming and Scripting

Replacing Double Quote in Double Quote incsv file

Hi All , We have source data file as csv file and since data could contain commas ,each attribute is quoted into double quotes.However problem is that some of the attributa data also contain double quotes which is converted to double double quote while creating csv file XLs data : ... (2 Replies)
Discussion started by: Shalini Badal
2 Replies

4. UNIX for Dummies Questions & Answers

To quote or not

My question is, "Do I not understand, or is my information out of date?" I am trying to just be a student, rtfm'ing. I am working on my work systems. Is it simply that the book was printed in 2002 and a lot has changed since then, or did I miss something? Working in Korn Shell. I have been... (5 Replies)
Discussion started by: g.j.huebschman
5 Replies

5. Solaris

Scripiting quote and variable issues

Hello all I have an interesting problem here that I can't seem to figure out. Note this exists inside a script with the following header: m#!/usr/bin/sh What I am trying to do is build an automounting script for USB hdd's, the idea is that the user plugs their drive in then runs the script. The... (5 Replies)
Discussion started by: striker0010
5 Replies

6. Shell Programming and Scripting

replacing a quote in some lines with multiple quote fields

i want to replace mistaken quotes in line starting with tag 300 and relocate the quote in the correct position so the input is 223;25 224;20100428064823;1;0;0;0;0;0;0;0;8;1;3;9697;18744;;;;;;;;;;;; 300;X;Event:... (3 Replies)
Discussion started by: wradwan
3 Replies

7. Shell Programming and Scripting

Regex in grep to match all lines ending with a double quote (") OR a single quote (')

Hi, I've been trying to write a regex to use in egrep (in a shell script) that'll fetch the names of all the files that match a particular pattern. I expect to match the following line in a file: Name = "abc" The regex I'm using to match the same is: egrep -l '(^) *= *" ** *"$' /PATH_TO_SEARCH... (6 Replies)
Discussion started by: NanJ
6 Replies

8. Shell Programming and Scripting

double-quote inside double-quote

hey all, i made a simple .sh like this: echo "<style media="screen" type="text/css">@import url("main.css");</style>" but the output is: <style media=screen type=text/css>@import url(main.css);</style> i want to keep double-quotes, can anyone help me? thanks (3 Replies)
Discussion started by: indraf
3 Replies

9. Shell Programming and Scripting

Capturing Data between first quote and next quote

I have input file like RDBMS FALIURE UTY8703 'USER_WORK.TEST' .HIghest return code '12' I want to parse data which comed between first quote till next quote USER_WORK.TEST can you please suggest how to do that (4 Replies)
Discussion started by: scorp_rahul23
4 Replies

10. Shell Programming and Scripting

Problem with double quote and string variable

Hello, i have a file output.txt which contains a single line with a list of files with quotes : "file1.ext" "file2.ext" "file3.ext" In a shell script, I want to retrieve the line and use it as a variable in a command like : zip archive.zip $LIST I cant get it work. When I physically type... (6 Replies)
Discussion started by: mattemp
6 Replies
Login or Register to Ask a Question