Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This dir was created during a download from tthe web. Example: smith&johnson Impossible for me to change to that dir. The shell interprets as the the background indicator. I tried enclosing the name in quotes, but no use. Any idea?
Thanks. The filename is of the form ./foo1&foo2/foo3 and suppose I am in ./. The file manager in the gui has no problem with it. 'cd foo1\&foo2' won't work. I did 'cd foo1*foo2' and it worked. Your solution is still better, I think. It's a pity it is in CD-ROM, becouse then I cannot move it.
Glad I could help and thanks for the update. Feedback helps me learn.
Quote:
Originally Posted by stf92
The file manager in the gui has no problem with it.
This is important, because you can browse the directory and verify that its contents are not malware.
I'm too lazy to test this, but I doubt that Windows would like to see an ampersand in a directory or file name either. I would question the competence of the folks wrote this.
Edit: When I stumbled onto the fact that wildcards work in directory names, I was giddy.
After untarring file blahblahblahblahblah-x.x.x.tar.gz, I could enter the new directory by typing cd blah*.
That has saved me thousands of keystrokes over the years.
Thanks. The filename is of the form ./foo1&foo2/foo3 and suppose I am in ./. The file manager in the gui has no problem with it. 'cd foo1\&foo2' won't work. I did 'cd foo1*foo2' and it worked. Your solution is still better, I think. It's a pity it is in CD-ROM, becouse then I cannot move it.
Quoting and escaping should work, as illustrated in this command prompt session:
Code:
c@CW8:/tmp$ mkdir 'smith&jones'
c@CW8:/tmp$ ls -d 'smith&jones'
smith&jones
c@CW8:/tmp$ ls -d "smith&jones"
smith&jones
c@CW8:/tmp$ ls -d smith\&jones
smith&jones
c@CW8:/tmp$ cd 'smith&jones'
c@CW8:/tmp/smith&jones$ cd /tmp
c@CW8:/tmp$ cd "smith&jones"
c@CW8:/tmp/smith&jones$ cd /tmp
c@CW8:/tmp$ cd smith\&jones
c@CW8:/tmp/smith&jones$
If they do not work but wildcarding does, it may be that the name is not as it appears. echo -n smith*johnson | od -a (or some other od option) might be revealing.
The name of the directory as seen on the screen is Liszt\ -\ Piano\ Concertos\ 1\ &\ 2/. Now,
Code:
echo -n Liszt\ -\ Piano\ Concertos\ 1\ *2|od -a
0000000 L i s z t sp - sp P i a n o sp C o
0000020 n c e r t o s sp 1 sp & sp 2
0000035
Thanks.
@frankbell: being able to use computers at home has a price. The price is the computer is now thought to be used by the housewife. There was a time when filenames were limited to 7 or 8 chars long.
'cd foo1\&foo2' will not work because it is one word so the shell looks for a command of exactly that name. It should result in bash: cd foo1\&foo2: command not found
Are you still unable to cd using cd Liszt\ -\ Piano\ Concertos\ 1\ \&\ 2 or cd 'Liszt - Piano Concertos 1 & 2'? If so, what does echo -n Liszt* | od -a show?
I can now using any of the two forms. I think I didn't exhaust all possibilities before posting. I first escaped '&' but I must have made some mistake. Then I tried quoting: I typed
cd "List\ -\ Piano\ Concertos\ 1 &\ 2". This gave me 'No such file or directory'. Instead, doing
cd "Li
using autocompletion gave me
cd "List - Piano Concertos 1
and I completed
cd "List - Piano Concertos 1 & 2"
and this effectively changed directory.
Yes, I some see the OS display spaces as '\ ' and others as mere spaces and I think it contributed to the confusion. I must pay attention when it does one thing and when the other.
As to filename lengths, I remember minicomputers and some microcomputers, the latter built around 8080 or Z80, using file names no longer than seven chars in all. But could you tell me if the first implentations of Unix allowed anything else than letters, numbers and underscore for the filenames?
Yes, I some see the OS display spaces as '\ ' and others as mere spaces and I think it contributed to the confusion. I must pay attention when it does one thing and when the other.
As to filename lengths, I remember minicomputers and some microcomputers, the latter built around 8080 or Z80, using file names no longer than seven chars in all. But could you tell me if the first implentations of Unix allowed anything else than letters, numbers and underscore for the filenames?
The "backslash escape" convention is widely used, including by bash's tab-completion for metacharacters.
AFAIK UNIX allowed all characters except / in file names from the beginning.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.