Code Hungry
Code Hungry

Reputation: 4000

How to Add Double Quotes in Shell Script

Sorry for Asking very Basic Question. I am Doing SVN Export with the help of shell Script and Cygwin.Following is the Shell Script.

#!/bin/bash
echo "Svn_path="$1 
echo "Destination_Path="$2 
echo "Svn_version="$3 
echo "Svn_username="$4 
echo "Svn_password="$5 
svn export $1 $2 -r $3 --username $4 --password $5 --force --non-interactive

This Script works Fine When Destination_path Does not contains Space. eg:-D:\Test. If My Destination_Path Contains Space it Won't Work.eg:-D:\Test Folder

Solution For this I have to Pass $2 parameter in Double Quotes. How to Do this.

Upvotes: 1

Views: 1689

Answers (1)

jørgensen
jørgensen

Reputation: 10549

Uhm, well, you simply add double quotes around $2. You do this using a keyboard normally, but Google also has Morse input pads and other HIDs.

#!/bin/bash
echo "Svn_path=$1" 
echo "Destination_Path=$2"
echo "Svn_version=$3"
echo "Svn_username=$4"
echo "Svn_password=$5"
svn export "$1" "$2" -r "$3" --username "$4" --password "$5" --force --non-interactive

Always add double quotes where word expansion is not desired.

Upvotes: 2

Related Questions