Link to home
Start Free TrialLog in
Avatar of Midhun 123
Midhun 123

asked on

Is there anyway to provide space in between folder name (for moving files from one linux server to another) in shell script?

Hi Experts,

Good Day..

 I have a shell script which moves files from one linux server to another.

As per the requirement , Output path folder contains space in between folder name ..eg ----outputserver/file out/date on file/.

According to my knowledge , If path contains space in between,command wont execute successfully.

Can anyone help on this how to proceed further..Is there anyway to give path with space like mentioned above.
ASKER CERTIFIED SOLUTION
Avatar of Apurva Bhandari
Apurva Bhandari
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Your answers are above, just a tip: if you have to type that output folder in a shell, use the TAB key to auto-complete the path.

So type this:

outputserver/file[TAB]out

which will auto-complete to:

outputserver/file\ out

(\ is one of the 2 answers given above)
Avatar of Midhun 123
Midhun 123

ASKER

Thank You for all your help..
I have a question ..Inside Shell Script,I am using cd command.

for 'CD' Command also,Can we use doubel quotes?
Yes, it possible to use spaces whatever you want, as far as any other special charater, just use "\" symbol before it.

so your path /home/user/My documents/file turn into: /home/user/My\ documents/file

or you could use quotes for entire path:
"/home/user/My documents/file"
Sure, in your case:

cd "outputserver/file out/date"
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No, it's not working that way, Dmitriy. An asker might prefer comments over others, but an Expert should not if posting a closing suggestion.
Are the first two comments correct? Yes, so they deserve points.
Your comment however is a reply for a follow-up question, not really adding more info (only confirming that it works for cd), and despite several Experts already contributed.

My suggestion is 250 points for each of
  https:#a42603149
  https:#a42603154
  https:#a42603226
  https:#a42603872
as this are replies to the original question, and noci provided useful explanations (so getting double points).