12-03-2012
File paths with spaces in a variable
Hi all my very first post so go easy on me!!
I am trying to build a very simple script to list a file path with spaces in. But I can't get around this problem. My script is as follows:
#!/bin/bash
X="/Library/Users/Application\ Support/"
LS="ls"
AL="-al"
$LS $AL $X
The response I get is this
ls: /Library/Application\: No such file or directory
ls: Support/: No such file or directory
I know this is a problem with the space in the file path but I thought the "" would pass to the commandline with no issues but I am wrong.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help.
echo $SH_VAR | command_line Syntax.
The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
Discussion started by: jerardfjay
6 Replies
2. Shell Programming and Scripting
Hi,
my var is:
PATH_LOG=/opt/WebSphere/CR Comune Roma.log
a filename which contains blank chars.
How can I call it from prompt ?
Ex:
ls $PATH_LOG or
cat $PATH_LOG
tks,
Carmen- (2 Replies)
Discussion started by: Carmen123
2 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I found the mimesender multiple attachment emailing shell script in the FAQ of these forums, and I have been able to use it to send multiple files, but only if they don't have spaces in their file name or path.
When I attempt to send a file with spaces in it's name, enclosed... (0 Replies)
Discussion started by: rsmorra
0 Replies
4. Shell Programming and Scripting
Hello All,
I am trying to remove all tabspaces and all blankspaces from my file using sed & awk, but not getting proper code. Please help me out.
My file is like this (<b> means one blank space, <t> means one tab space)-
$ cat file
NARESH<b><b><b>KUMAR<t><t>PRADHAN... (3 Replies)
Discussion started by: NARESH1302
3 Replies
5. Shell Programming and Scripting
I suppose the easiest way to explain my problem is to show you some code and then show you what the code outputs:
--------------------------------------------------
#!/bin/bash
echo "This line has spaces" > "/tmp/This Filename Has Spaces.txt"
export Foo=$(cat "/tmp/This Filename Has... (4 Replies)
Discussion started by: nrogers64
4 Replies
6. Shell Programming and Scripting
Hi,
i call my shell like:
my_shell "my project name"
my script:
#!/bin/bash -vx
projectname=$1
sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp
cp temp test_config_doxy
the following error occurres:
sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies
7. Shell Programming and Scripting
Hi guys,
I'm working on a large set of scripts to move files around several servers and manipulate them for our staff. Basically we're shooting things, the videos hit a server and then need organised due to the language they've been shot in. Our XML (designed for Apple's Final Cut Pro) is right... (6 Replies)
Discussion started by: omfgbunnies
6 Replies
8. Shell Programming and Scripting
I am working on a script for Mac OS X that, among many other things, gets a list of all the installed Applications. I am pulling the list from the system_profiler command and formatting it using grep and awk. The problem is that I want to be able to use each result individually later in the script.... (3 Replies)
Discussion started by: cranfordio
3 Replies
9. Shell Programming and Scripting
Hi I want to know how to handle the spaces in the below scenario.
I have a file (CON_zip_path_1.txt) which has some directory paths with spaces in directory names . My requirement is to unzip these zip files to
another path. Please see the code below and the error.
CON_zip_path_1.txt... (4 Replies)
Discussion started by: paul1234
4 Replies
10. Shell Programming and Scripting
Hi I want to read a text file and replace various number of spaces between each string in to a single "," or any other character .Please let me know the command to do so. My input file is a txt file which is the output of a SQL table extract so it contains so many spaces between each column of the... (2 Replies)
Discussion started by: Hari Prasanth
2 Replies
LEARN ABOUT DEBIAN
lltag_formats
lltag_formats(5) File Formats Manual lltag_formats(5)
NAME
formats - Internal formats database file for lltag
DESCRIPTION
The internal format database is usually stored in /etc/lltag/formats. The user may override this file by defining a $HOME/.lltag/formats.
If this file exists, the system-wide one is ignored.
These files contain entries starting with a line such as:
[%n - %a - %t]
A title between bracket that will be displayed at runtime.
Then, the following 3 lines must be given to explain how the format is actually used to parse filenames:
type = basename
The type is either basename (to parse the last part of the path to a file) or path (to parse the directory part of the path to a
file). When actually parsing the path to target files, basename and path parsers will be assembled. All possible combination will
be tried.
regexp = %L%N%S-%S%A%S-%S%A%L
A string composed of any characters, with the following special fields:
%L for delimiter (empty by default, multiple spaces if --spaces was given)
%S for a space (or multiple spaces if --spaces was given)
%N for numbers
%A for an alphanumeric string without /
%P for any path (alphanumeric string with /)
%% for %
indices = NUMBER,ARTIST,TITLE
A list of fields to match (either given by their full name or associated letter) corresponding to each %N or %A field in the previ-
ous format. It may be AUTHOR (or a), ALBUM (A), GENRE (g), NUMBER (n), TITLE (t), DATE (d), COMMENT (c) or IGNORE (i). See also
FORMAT in the manpage of lltag for details about these fields.
SEE ALSO
lltag(1)
AUTHOR
Brice Goglin
NOVEMBER 2006 lltag_formats(5)