Re: How do I get a list of filenames with spaces on bash?



On Wed, 23 Jan 2008 20:42:46 -0800, Chad wrote:

A long time ago, some Professor used some kind of 'echo' combination on
Unix to get a list of filename with space. I no longer have a copy of
the script.

I was tried something like the following
[cdalten@localhost ~]$ echo */


In bash you could use

[cdalten@localhost ~]$ ls *\ *

Note that is a \ not a /
The \ makes the shell treat the following space like a regular
character, not a word separator.

If you prefer to use echo

[cdalten@localhost ~]$ echo *\ *

Would also work, but the filenames would all come
out on one line, making them hard to read.

What do you want to do, just list filenames with spaces, or do something
to the filenames with spaces?
.



Relevant Pages

  • Re: For Loops and Space in Names
    ... Spaces don't belong in filenames and they make ... I'm going to include a script I wrote a long ... | One lesson I learned writing this was to use lot's of double quotes. ... Default is to recite commands and a -x option would make ...
    (Fedora)
  • Re: Exiting os.spawnvs subroutine
    ... Main script: ... # Define arguments for subprocess ... filenames = os.listdir ... print "Successfully contoured at 100 meter interval!" ...
    (comp.lang.python)
  • Re: Iterations
    ... > My users tend to invite a lot of spyware. ... > large portions of a script for each file. ... instead of running this code at each individual workstation that you ... >> filenames so much as specific files, as you are looking only in the root ...
    (microsoft.public.windows.server.scripting)
  • Re: sort files by exif date
    ... >> and the filenames in a list, sort, then extract the filenames again. ... >> Probably a few lines of shell script. ... That string will be a line of text. ...
    (comp.unix.questions)
  • Re: Help with emailing attachments with Ruby...
    ... I'd use Ruby-Mail or ActionMailer ... thing instead of something wrong with my script. ... # This portion of the code assembles the filenames of the files # ...
    (comp.lang.ruby)