Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Aug 2008 06:19:42 -0400
From:      David Banning <david+dated+1219918782.39167f@skytracker.ca>
To:        questions@freebsd.org
Subject:   space char shell script problem
Message-ID:  <20080823101941.GA42601@skytracker.ca>

next in thread | raw e-mail | index | archive | help
I am running into a problem with the space character in filenames.
For instance, If I want to run the script;

for x in `ls`
do
  echo $x
done

then filenames that have a space in them ie: "john smith.jpg"
are processed by my script as two names, "john" and "smith.jpg".

What is the best way to deal with this type of space problem in the shell?

I know that file names in quotes solves some problems but I can't tranfer
that to my script.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080823101941.GA42601>