LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   touch utility question (https://www.linuxquestions.org/questions/linux-software-2/touch-utility-question-441034/)

twistedpair 05-02-2006 05:24 PM

touch utility question
 
All,
When I issue the following comand:

touch *test

it gives me a file:

/*test

This is ridiculous. How do I turn that off?

Thanks!
Pair

ataraxia 05-02-2006 05:41 PM

What do you want it to do? Not create any files, but just touch them if there are any? Use "-c" flag.

twistedpair 05-02-2006 06:35 PM

Well it creates a file called

/*test

I would like it to create a file called:

*test

Sorry, I was a little vague.

twistedpair 05-02-2006 08:19 PM

Any ideas at all? Anyone?

pixellany 05-02-2006 08:54 PM

On my machine (Ubuntu 5.10, bash) it works the way you were hoping. I cannot imagine where the "/" might be coming from.

twistedpair 05-02-2006 08:56 PM

Exactly. On all my other machines it works the way it is supposed to. Unfortunately I don't exactly have the choice to re-install, or use another machine.

Other commands work the same way too. openssl for instance is affected too.

syg00 05-02-2006 09:36 PM

alias ???????

twistedpair 05-03-2006 12:30 AM

Would it help if I said that if I did this:

touch \*test

that I still get:

\*test

instead of the expected:

\\*test

Also,

mkdir *test

gives me:

\*test/

I kid you not.

twistedpair 05-03-2006 01:16 AM

Jeez, well hopefully it isn't going to matter. It seems that if I:

mkdir *test

and it creates:

\*test/

I can still rm -d *test

and it will work. I am hoping that even though it shows up as:

\*test

that I can still create manipulate and delete it by its given name of *test. In other words, despite having the \ character in front of it, I don't need to use the \ character to refer to it when performing any kind of adds deletes or changes. So I guess the problem is actually a non-problem? I HOPE so.

-Pair

syg00 05-03-2006 07:02 AM

I had a bit of a play this 'arvo.
Create a *test, and a \*test - separate files, I checked the inodes.

rm'd the *test - both files disappeared.
Did it all twice, just to be sure.

Merely more evidence - I offer no explanation.

twistedpair 05-03-2006 09:13 AM

I know that the "\" character is used as an escape character. Incidentally if you create a file:

touch @test

It does the same thing:

\@test

Oddness.

Wim Sturkenboom 05-03-2006 10:33 AM

Does it give you a forwardslash (I think that that was a typo) or a backslash?

I guess that the last one makes sense. The backslash is the escape character indicating that the next character has to be taken literally (as you already mentioned). It will not be in the actual filename, but only in the representation in the shell.
'*' and '@' have special meanings, '*' as wildcard character and '@' for symbolic links (if I'm correct).
I suppose that there are a few more (question-mark and ...).

Code:

wim@btd-techweb01:~/test$ mkdir *test
wim@btd-techweb01:~/test$ ls -l
total 1
drwxr-xr-x  2 wim users 48 2006-05-03 17:48 \*test/
wim@btd-techweb01:~/test$ mkdir \test
wim@btd-techweb01:~/test$ ls -l
total 1
drwxr-xr-x  2 wim users 48 2006-05-03 17:48 \*test/
drwxr-xr-x  2 wim users 48 2006-05-03 17:49 test/
wim@btd-techweb01:~/test$ mkdir \\test
wim@btd-techweb01:~/test$ ls -l
total 2
drwxr-xr-x  2 wim users 48 2006-05-03 17:48 \*test/
drwxr-xr-x  2 wim users 48 2006-05-03 17:49 \\test/
drwxr-xr-x  2 wim users 48 2006-05-03 17:49 test/
wim@btd-techweb01:~/test$ rmdir *test
wim@btd-techweb01:~/test$ ls -l
total 0
wim@btd-techweb01:~/test$

Please note the command rmdir *test. It removes all 'test' directories as the '*' is the wildcard. Doing the same, but adding a backslash before the asterisk only deletes the intended directory.

PS using slackware 10.1


All times are GMT -5. The time now is 11:23 AM.