LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-28-2010, 03:40 AM   #1
sumeet inani
Member
 
Registered: Oct 2008
Posts: 902
Blog Entries: 26

Rep: Reputation: 49
file path contains space


I use gnome-terminal in ubuntu 8.04 . It is bash .

#cp "/data/sumeet/linux/ubuntu 8.04/xorg-dev/*.deb" ~/installed
cp: cannot stat `/data/sumeet/linux/ubuntu 8.04/xorg-dev/*.deb': No such file or directory

If I remove double quotes & replace space in folder path by \space then it works fine
#cp /data/sumeet/linux/ubuntu\ 8.04/xorg-dev/*.deb ~/installed
#

(1)Does this mean that * is not expanded in string ? How can I make terminal interpret the * as wild card when * is in double quotes ?
 
Old 02-28-2010, 03:59 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Quote:
Originally Posted by sumeet inani View Post
Does this mean that * is not expanded in string ? How can I make terminal interpret the * as wild card when * is in double quotes ?
You can't. The literal meaning of * is preserved inside double quotes. From the Bash reference manual:
Quote:
Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.
From the command line, you can always try TAB completion to automatically escape the blank space and spare typing.
 
Old 02-28-2010, 04:08 AM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,074

Rep: Reputation: 386Reputation: 386Reputation: 386Reputation: 386
You can do

Code:
cp /foo/moo\ cow/*.bar
# or
cp "/foo/moo cow/"*.bar
# or just
cp /foo/moo" "cow/*.bar
Read the bash man page if you want to know more about quoting and special characters.
 
1 members found this post helpful.
Old 03-02-2010, 01:49 AM   #4
sumeet inani
Member
 
Registered: Oct 2008
Posts: 902
Blog Entries: 26

Original Poster
Rep: Reputation: 49
Thank You i92guboj
i ran
$cp "/data/sumeet/linux/ubuntu 8.04/xorg-dev/"*.deb ~
It worked as desired.That is what I was looking for.
Though I couldn't express my question clearly.
This allows me to copy location from address bar of file manager and using it as it is.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
space char in virtual host path doesn't work ... demia Linux - Server 2 05-02-2009 01:02 PM
Find a file path and directory path ak.lokesh Linux - Newbie 3 02-19-2009 12:37 PM
Loop with space in path fredrikny Programming 1 01-30-2008 05:24 PM
How to have a space in a path? xpucto Linux - Newbie 2 01-11-2008 07:54 AM
miktex yap does not open path name with space, and other problems parv Linux - Software 5 03-06-2007 04:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration