The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Dealing with spaces in file names in a shell script same1290 Shell Programming and Scripting 5 08-13-2008 12:01 AM
How to list filenames with spaces in shell script hikrishn Shell Programming and Scripting 1 06-18-2008 05:33 PM
TRIM spaces in shell anumkoshy UNIX for Advanced & Expert Users 3 08-31-2007 05:13 AM
Strip leading and trailing spaces only in a shell variable with embedded spaces jerardfjay Shell Programming and Scripting 6 03-07-2005 02:24 PM
any explanation for thsi shell script behaviour xiamin Shell Programming and Scripting 9 11-09-2001 01:13 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-03-2009
SDelroen SDelroen is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 8
Spaces behaviour in shell

Hello,

I am a bit puzzled by the way my shell treats spaces in filenames.

An example will be way clearer than any explanation I can make:
Code:
$ ls test\ file\ with\ spaces
test file with spaces
$ var="test\ file\ with\ spaces"
$ echo $var
test\ file\ with\ spaces
$ ls $var
ls: cannot access test\: No such file or directory
ls: cannot access file\: No such file or directory
ls: cannot access with\: No such file or directory
ls: cannot access spaces: No such file or directory
The problem is the same if I am using double quotes around the filename or when I nest a command displaying the filename.

I've been crawling on the internet for a long time, but I haven't been able to find any documentation on this particular issue.
 

Bookmarks

Tags
shell spaces

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:45 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0