Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
[MYSTERY SOLVED] What does "echo ???????????????" really do?
It seems to alternate between listing an Nth file (somewhat obscurely related with the number of question marks) on the current folder, or giving some "history" entry, I guess.
That's weird.
After that, adding question marks just echoed more question marks, as expected.
Here's the explanation, "?" is a wildcard!
19:06 dsc /tmp $ touch 1
19:06 dsc /tmp $ echo ?
1
19:06 dsc /tmp $ touch 12
19:06 dsc /tmp $ echo ??
12
19:06 dsc /tmp $
That's weird.
Code:
22:54 **ROOT** /# echo ? ? 22:54 **ROOT** /# echo ?? ?? 22:54 **ROOT** /# echo ??? bin dev etc lib mnt opt run smb srv sys tmp usr var 22:55 **ROOT** /# echo ???? boot home proc root sbin 22:55 **ROOT** /# echo ????? lib64 media 22:55 **ROOT** /# echo ?????? ?????? 22:55 **ROOT** /# echo ??????? var-bak vmlinuz 22:55 **ROOT** /# echo ???????? ???????? 22:55 **ROOT** /# echo ????????? ????????? 22:55 **ROOT** /# echo ?????????? initrd.img 22:55 **ROOT** /# echo ??????????? vmlinuz.old 22:55 **ROOT** /# echo ???????????? ???????????? 22:55 **ROOT** /# echo ????????????? ????????????? 22:55 **ROOT** /# echo ?????????????? initrd.img.old 22:55 **ROOT** /# echo ??????????????? ???????????????
After that, adding question marks just echoed more question marks, as expected.
Code:
22:56 **ROOT** /# ls -1 bin/ boot/ dev/ etc/ home/ lib/ lib64/ media/ mnt/ opt/ proc/ root/ run/ sbin/ smb/ srv/ sys/ tmp/ usr/ var/ var-bak/ initrd.img initrd.img.old vmlinuz vmlinuz.old 22:56 **ROOT** /#
Here's the explanation, "?" is a wildcard!
Quote:
Question mark wildcard
The ? (question mark) is used to match exactly one character. For example three question marks (???) would represent any file name onsisting of three characters. In this example, the rm command would delete all files in the current directory whose names, inclusive of any extensions, are exactly three characters in length:
rm ???
The following would tell the rm command to delete all files in the current directory that begin with the letter z and are six characters in length:
rm z?????
The following would tell the rm command to delete all files in the current directory that have a two-character filename extension:
rm *.??
http://www.cyberciti.biz/faq/unix-rm...ctory-command/
The ? (question mark) is used to match exactly one character. For example three question marks (???) would represent any file name onsisting of three characters. In this example, the rm command would delete all files in the current directory whose names, inclusive of any extensions, are exactly three characters in length:
rm ???
The following would tell the rm command to delete all files in the current directory that begin with the letter z and are six characters in length:
rm z?????
The following would tell the rm command to delete all files in the current directory that have a two-character filename extension:
rm *.??
http://www.cyberciti.biz/faq/unix-rm...ctory-command/
Quote:
19:06 dsc /tmp $ touch 1
19:06 dsc /tmp $ echo ?
1
19:06 dsc /tmp $ touch 12
19:06 dsc /tmp $ echo ??
12
19:06 dsc /tmp $
Total Comments 4
Comments
-
Try
Code:\echo ????
Posted 04-21-2016 at 06:09 AM by Habitual -
Code:
18:07 dsc / $ \echo ???? boot home proc root sbin
Just noticed something similar happens even with printf, with a less "parsed" output (no newlines, as usual), and somewhat different as well:
Code:18:12 dsc / $ printf ???? boot18:12 dsc / $ 18:12 dsc / $ \printf ???? boot18:12 dsc / $ 18:12 dsc / $
And also with plain bash (I guess):
Code:18:43 dsc / $ bash --norc bash-4.3$ echo ???? boot home proc root sbin bash-4.3$
Eventually I'll boot on Debian to see if it does the same.
Still on Ubuntu Wily, the mystery-folder/file through "?????" is also present in other commands, such as ls:
Code:18:57 dsc / $ echo ??? bin dev etc lib mnt opt run smb srv sys tmp usr var 18:57 dsc / $ ls -1 ??? bin: bash bunzip2 bzcat [...]
Posted 04-21-2016 at 04:07 PM by the dsc
Updated 04-21-2016 at 04:59 PM by the dsc -
erm,
I don't know why that didn't "click" earlier.
Glad it worked out.Posted 04-21-2016 at 08:27 PM by Habitual -
It would probably have been more obvious if I hadn't had the impression that it was somehow echoing history entries, for some reason.
Posted 04-28-2016 at 08:01 AM by the dsc