Results 1 to 5 of 5
Hi.
I have files in my OS that has wierd file names with not-conventional ascii characters.
I would like to run them but I can't refer them.
I know the ...
- 10-07-2007 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 5
Wierd Ascii characters in file names
Hi.
I have files in my OS that has wierd file names with not-conventional ascii characters.
I would like to run them but I can't refer them.
I know the ascii # of the problematic characters.
I can't change their name since it belongs to a 3rd party program... but I want to run it.
is there anything like :
./procc"/45"sds.sh ?
doesn't work for me.
thanks,
- 10-07-2007 #2
The first step is to know whether you "know" the value of the ASCII character in decimal, octal, or hexadecimal. For example, the value of the ASCII character "5" can be expressed thus:
- in decimal: 53
- in octal: 65
- in hex: 35
To see how this works for all members of the ASCII character set, do this at the command prompt:
But that won't help you, because the character in which you're interested has its most significant bit set, so it's not a member of the ASCII character set.Code:man ascii
I recommend that you use the octal representation of any non-ASCII character in a filename, because the program ls lets you discover its value easily. Consider this demonstration from real life, formatted to fit your television screen:
You might not need to know the exact value of the non-ASCII character. If you specify the directory exactly, or if the program is in your current directory, and there's only one file whose name consists of "a", some other character, and "c", you can run that program thus:Code:wally:~/sunday/1$ # You can find all filenames with non-ASCII characters thus: wally:~/sunday/1$ wally:~/sunday/1$ ls a?c t1 wally:~/sunday/1$ wally:~/sunday/1$ # See the question mark? That means that the character is wally:~/sunday/1$ # either an actual question mark or a non-ASCII character. wally:~/sunday/1$ wally:~/sunday/1$ # Let's find the octal representation of that character. wally:~/sunday/1$ wally:~/sunday/1$ ls -b a\241c t1 wally:~/sunday/1$ wally:~/sunday/1$ # We can refer to that file explicitly thus: wally:~/sunday/1$ wally:~/sunday/1$ ls -l a$'\241'c -rwx------ 1 wally wally 60 Oct 7 06:02 a?c wally:~/sunday/1$ wally:~/sunday/1$ # Of course, if it's a program, we can run it thus: wally:~/sunday/1$ wally:~/sunday/1$ a$'\241'c This is a program whose program file has a funny name. wally:~/sunday/1$
orCode:a?c # This assumes that . is part of your $PATH.
orCode:some/directory/or/other/a?c
That will work no matter what the second character is, whether it's in the ASCII character set or not.Code:/some/directory/or/other/a?c
Hope this helps.
- 10-07-2007 #3Just Joined!
- Join Date
- Oct 2007
- Posts
- 5
Solaris ?
Thanks a lot !
It worked perfectly on my linux box.
however - it doesn't work on my Solaris machine.
Do you know how I can implement it there ?
on linux :
[root@localhost ~]# echo $'\x6c\x73'
ls
On solaris :
# echo $'\x6c\x73'
$\x6c\x73
thanks.
- 10-07-2007 #4Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
What shell are you running on Solaris? You're relying in the shell doing the character interpretation, and you're probably not using bash, but either a vanilla Bourne shell (sh) or the primitive 88i(?) Korn shell (ksh) that Solaris ships with.
- 10-08-2007 #5
I fear that scm's right.
Got Perl on that Solaris system? If you do, try this at your shell command prompt:
This should work for any version of Perl, even Perl 4.Code:perl -e 'system("echo \x6c\x73") && die $!'


Reply With Quote