jedaffra
January 12th, 2003, 13:31
Hi,

I have a filename that I want to rename but am not able to do so because the filename contains an exclamation point.

example: "this is - an example!.xxx"

Thanks :oops:

v902
January 12th, 2003, 13:46
mv this is - an example\!.xxx blah

or just

mv this is - an example*xxx" blah

jedaffra
January 12th, 2003, 15:19
That did the trick, thanks.

v902
January 12th, 2003, 15:34
That did the trick, thanks.

anytime, \ is your friend :D

Kernel_Killer
January 12th, 2003, 20:52
Just a question for my understanding. What kind of file does the "!" represent? Also, what is with the "\" ? I know this is in OpenBSD, but I assume the file sturcture is the same with the other BSDs. I had 2 XF86Config files in /etc/X11, but when doing the autocomplet in CLI with <tab>, it showed 'XF86Config', and 'XF86Config\' , but didn't show that with 'ls'/. What am I missing?

|MiNi0n|
January 12th, 2003, 21:19
Just a question for my understanding. What kind of file does the "!" represent?

Ok. Another way around the ! in your file name would be to just double quote it. So:

mv "filename!.foo" file.foo

The ! represents a ! of course :lol: A bang that is. Likely being interpreted in this sense as a repeat command. You are familiar with !!?? So if you do:

aurora# ls -l
total 2
drwx------ 2 www www 512 Jan 12 01:30 fcgi
-rw-r--r-- 1 root wheel 614 Jan 12 19:56 pigstate
-rw-r----- 1 root wheel 0 Jan 12 20:01 tmp.0.aNmSd9687

And then a bang bang afterwards, it repeats the last command issued:

aurora# !!
ls -l
total 2
drwx------ 2 www www 512 Jan 12 01:30 fcgi
-rw-r--r-- 1 root wheel 614 Jan 12 19:56 pigstate
-rw-r----- 1 root wheel 0 Jan 12 20:01 tmp.0.aNmSd9687

But say imbetween you issue another command, say echo, but you want to issue that ls command again you could do a !l to specify the last l command I issued:

aurora# ls -l
total 2
drwx------ 2 www www 512 Jan 12 01:30 fcgi
-rw-r--r-- 1 root wheel 614 Jan 12 19:56 pigstate
-rw-r----- 1 root wheel 0 Jan 12 20:01 tmp.0.aNmSd9687
aurora# echo foo
foo
aurora# !l
ls -l
total 2
drwx------ 2 www www 512 Jan 12 01:30 fcgi
-rw-r--r-- 1 root wheel 614 Jan 12 19:56 pigstate
-rw-r----- 1 root wheel 0 Jan 12 20:01 tmp.0.aNmSd9687

Phew! Long winded huh? :lol:

Also, what is with the "\" ? I know this is in OpenBSD, but I assume the file sturcture is the same with the other BSDs. I had 2 XF86Config files in /etc/X11, but when doing the autocomplet in CLI with <tab>, it showed 'XF86Config', and 'XF86Config\' , but didn't show that with 'ls'/. What am I missing?

Now the \ is a way of delimiting the character so that it gets interpreted as a regular character and not an expression or command.

Depending on your shell, using filec will automatically delimit odd characters for you. So, bash will do this where sh (root!) will not on OBSD:

Using sh and trying to cd into a folder called Scott's Stuff will get you this:
aurora# cd Scott's Stuff
Unmatched '.


But in bash, filec will auto complete with the correct delimeters:
aurora# bash
bash-2.05a# cd Scott\'s\ Stuff/

This is not OS specific by the way! So it's not an OBSD thing. I think maybe what you really saw was XF86Config/ and not XF86Config\. The trailing slash simply means a directory. This again is typically a shell thing.

[/quote]

v902
January 12th, 2003, 21:42
It's a shell thing not an OS for sure ;). Also the real point of \ (or so I think) is to enter charecters that are special to the shell (for example ^, $, !, etc) or a space (so the computer doesnt think cp vlads stuff trash means coping vlads and stuff into trash but instead cp vlads\ stuff trash will copy "vlads stuff" into trash". |MiNi0n|: Never even heard of the !! but it looks cool, but i would just press up! =). I know though how to use !???? where ???? are numbers. For example history shows the commands and their numbers and if you are to lazy to do up alot of times and don't want to re-type it you can just do history|grep blah. And if it returns something like:

234 blah -l foo
826 blah -s 87 -l bar

Then you can just do:
$ !826
to execute blah -s 87 -l bar.

Kernel_Killer
January 13th, 2003, 03:17
Doh. I should have remembered the "\" thing, from SAMBA. :P

So I had 2 files "XF86Config" and ":XF86Config ".

|MiNi0n|
January 13th, 2003, 12:38
|MiNi0n|: Never even heard of the !! but it looks cool, but i would just press up! =).

Never heard of bang bang? Wow... that's an oldy but a staple :lol:

Using up is again a shell dependant thing. If you're using the default shell (sh) and are root on an OBSD box for example, that's gonna get you precisely nowhere :-) I suppose you could always switch to another shell but for root, that spawns an entirely different debate :-)

v902
January 13th, 2003, 20:03
1.) Generally just logging in as root is asking for trouble (setuid buffer overflows :shock:)

2.) sh?! In a million years... :)

3.) Still haven't got OBSD or FBSD, I hate burning stuff... hate it... and the boot floppies always screw up on me... So I am on Slackware right now...

|MiNi0n|
January 13th, 2003, 21:47
1.) Generally just logging in as root is asking for trouble (setuid buffer overflows :shock:)

Agreed! Merely an example.


2.) sh?! In a million years... :)


What, you don't like sh? :wink:


3.) Still haven't got OBSD or FBSD, I hate burning stuff... hate it... and the boot floppies always screw up on me... So I am on Slackware right now...


The boot floppies screw up? How so???

v902
January 13th, 2003, 21:56
Yeah, so many things can go wrong... Not just security, also just your stupidity and accidentally removing the wrong directory, ie /usr/bin (me does not want to talk about it :D)


sh? What the hell is this 1969? =) Man I would rather use vi for executing commands then sh :D


Well I should have said the install, the boot floppies are fine but after the partitioning I always have problems with the disk label part.... But I am sure it's just me screwing up, I bet I just gotta do some more STFW or RTFM but I am bit busy at the time...

frisco
January 13th, 2003, 22:40
Using up is again a shell dependant thing. If you're using the default shell (sh) and are root on an OBSD box for example, that's gonna get you precisely nowhere :-) I suppose you could always switch to another shell but for root, that spawns an entirely different debate :-)

i think you're thinking of csh (root default on OpenBSD), not sh.
using up-arrow in sh on OpenBSD (sh, which is mostly ksh) will get you the last commands executed.

v902
January 13th, 2003, 22:53
frisco, when I click up in sh I get ^[[A which is I believe what I should be getting....

elmore
January 13th, 2003, 23:20
what frisco was saying is that OpenBSD and for that matter all other *BSD's that I'm aware of use csh as the default shell not sh.

These other *nixes use the following for defaults:

SunOS and Solaris use sh.
Linux uses bash.
HP-UX uses ksh.

In any case the up arrow is a function of your shell conf file and really only requires a key mapping to access your command history provided your keeping one. Just thought I'd add that.

|MiNi0n|
January 13th, 2003, 23:39
what frisco was saying is that OpenBSD and for that matter all other *BSD's that I'm aware of use csh as the default shell not sh.

Right... csh. Cranial vapour lock :shock:


In any case the up arrow is a function of your shell conf file and really only requires a key mapping to access your command history provided your keeping one. Just thought I'd add that


Sorry... should have been more clear :-) shell dependant = prefs set for your shell. Translation: conf/rc files.

Speaking of which... elmore, still have those shell preferences that cause your prompt to chew up 65% of you screen?!?!

elmore@keyboard.MondayJanuary132003.11.waxingmoon. hightide.hadchicken.for.dinner$ :lol: