Re: how to type a space in a file path

From: adam bultman <adamb@glaven.org>
Date: Tue Sep 19 2006 - 22:15:52 AKDT

Blake Eggemeyer wrote:

>im trying to run a windows exe from command line(i have wune, and the
>program works when i click on it)
>the path is "/home/blake/.wine/drive_c/Program Files/iTunes/iTunes.exe"
>there is a space in "program files", what symbol do i use instead of the
>space?
>i had to do this before on a mac so i know what kind of solution it is. like
>the "20%" thing in web addresses that have spaces
>
>---------
>To unsubscribe, send email to <aklug-request@aklug.org>
>with 'unsubscribe' in the message body.
>
>
>
You want "\" . It's an escape char.

So, your command would be:

/home/blake/.wine/drive_c/Program\ Files/iTunes/iTunes.exe

You can use the escape character to escape things that would otherwise
be literal - like quotes.
Remember, if you use bash, you can tab-complete - so you could do:
/h <tab> b <tab> .w <tab> dr <tab> Pro <tab> iT <tab> iT <tab>

Assuming you type enough of the file/directory to make it unique (if
there are users 'bob' and 'blake' in /home, it'll print out the options
and you'll need to add another character or two until the file is unique
before tab completing it) you can tab complete anything. I use this
heavily - typing savings is high.

Another thing you could do (this doesn' have much to do with spaces in
file names, but with directories and such) you can make environment
variables to act as things. So, you could do, export
$ITUNES="/home.../iTunes.exe" (make sure you use the full path - I just
don't feel like typing it) you could just type $ITUNES at the command
prompt and it'd start it (or if you needed to run it in wine, you'd do
"wine $ITUNES", or you could put wine into the $ITUNES variable and just
call $ITUNES) Put those in .bashrc or .bash_profile, and each time you
log in it'll set those variables.

Also remember: your home directory is ~/ (or if you want to specify
another user's home dir, it is ~username). Comes in handy for daemons
like apache,radius, qmail, postfix, and the like that are run with
their own users (as opposed to root) or simply when you need to refer to
your home directory a lot.

One last thing: PS1 variable and PROMPT_COMMAND are useful for
finding who, and where you are. Here's mine:

PS1='\[\033[1;31m\][\[\033[1;33m\]$(date +%I:%M)
\[\033[1;36m\]\u@\[\033[1;32m\]\h\[\033[1;31m\]
\[:\]\w\[\033[1;31m\]]$\[\033[0m\]'

Prints out username@host: <path> . My name is in green. When I'm root,
red is used for the username color to help me remember that I'm root,
and that I need to tread lightly. (Root has another PS1, I need to add
an if statement to sense if I'm doing something like 'sudo bash', which
doesn't invoke root's environment.)

Finally, which is fun; PROMPT_COMMAND can be used to do things like put
labels on your terminals. I use gnome-terminal, and use tabs heavily to
save desktop space.However, the crappy thing is, without my
PROMPT_COMMAND, if I have 10 tabs open I don't know which tab goes to
which server. So, you specify a prompt command that sets the title of
the window (and in tabbed terminals, the tabs):
PROMPT_COMMAND='echo -ne "\033]0; ${USER}@$HOSTNAME:$PWD\007"'

So, each of my tabs will contain my username and the host - which is
useful until I have so many tabs it stops printing the label on the
tabs. I could shorten it, but I'm lazy. When a tab is active your
PROMPT_COMMAND appears in the titlebar.

Very fun, and very useful! Whee!

(Warning: My PS1 and PROMPT_COMMAND seem to be somewhat incompatible
with some sparc solaris machines.)

Adam

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Tue Sep 19 22:16:25 2006

This archive was generated by hypermail 2.1.8 : Tue Sep 19 2006 - 22:16:25 AKDT